Skip to content

Browser usage

Import the dedicated browser entry to exclude Node.js-only code:

import { send } from 'statocysts/browser'
await send('jsons://example.com/notifications', {
title: 'Browser event',
body: 'A client-side task completed.',
})

The browser entry includes:

  • Slack
  • Discord
  • Lark and Feishu
  • QQ Bot
  • Telegram
  • Bark
  • Server Chan
  • JSON and JSONS
  • Logger

Email is unavailable because it requires Node.js SMTP APIs.

Browser support does not guarantee that a remote notification service permits browser-origin requests. The target service must return compatible CORS headers. If it does not, send the notification from your server instead.

Browser delivery is appropriate for public or short-lived targets and endpoints designed for untrusted clients. Route privileged notifications through your backend.

Always use statocysts/browser in client code:

import {
createNotifier,
NotificationDeliveryError,
send,
} from 'statocysts/browser'

The runtime behavior and error types match the Node.js entry. See the API reference for their signatures.