@tobyt/infoscreenx-active-event-subscriber
v0.0.22
Published
InfoScreen X Active Event Subscriber
Downloads
6
Readme
InfoScreen X Active Event Subscriber
Find more information about InfoScreen X on Github: https://github.com/tobyt42/infoscreen
Usage
The event polling and parsing is done on a web worker thread. You can set up a worker manually or use a module such as worker-loader
.
Setting up active event worker
Example active-event.worker.js
import WorkerEventHandler from "@tobyt/infoscreenx-active-event-subscriber/WorkerEventHandler";
new WorkerEventHandler().init(global);
The reason why this class is not provided is that you may wish to configure the worker thread individually. For example, forcing moment-timezone
to use a particular timezone.
WorkerEventHandler will set the worker's onmessage
and will use postMessage
to post active events to the subscriber.
Communicating with the active event worker
import ActiveEventSubscriber from "@tobyt/infoscreenx-active-event-subscriber";
const worker; // Set up as per above
const config = {
eventCallback: function (activeEvent) { /*...*/ },
dataSource: {
type: 'poller|mock',
pollInterval: 20000,
requestUrl: 'https://...'
}
}
const subscriber = new ActiveEventSubscriber();
subscriber.start(worker, config);