Modules
module-beacon
The Beacon module batches browser events and flushes them through navigator.sendBeacon, with keepalive fetch as a fallback.
npm install @eventvisor/sdk @eventvisor/module-beaconimport { createEventvisor } from "@eventvisor/sdk";import { createBeaconModule } from "@eventvisor/module-beacon";const eventvisor = createEventvisor({ datafile, modules: [createBeaconModule({ url: "/collect", batchSize: 20 })],});Use transport: beacon in a destination. The module listens for pagehide and hidden-page transitions, then attempts to flush its bounded in-memory queue. Beacon delivery is still best effort. The browser does not provide a server acknowledgement.
Call await eventvisor.flush() when the application has a controlled shutdown path. The queue is memory-only, so it cannot survive a browser or process crash.
Options#
url: required string, or a function receiving transport metadata.name: module and transport name. Defaults tobeacon.batchSize: events per request. Defaults to20.flushIntervalMs: timed flush interval. Defaults to1000. Use0to disable it.maxQueueSize: bounded queue size. Defaults to1000.sendBeacon: custom Beacon function, useful for wrappers and tests.fetch: custom Fetch implementation used as the keepalive fallback.buildBody: function that receives a batch and returns the request body value.
Batches are grouped by resolved URL. The browser does not confirm server ingestion after sendBeacon accepts a payload.

