@tobyt/infoscreenx-active-event-subscriber

0.0.22 • Public • Published

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);

Readme

Keywords

none

Package Sidebar

Install

npm i @tobyt/infoscreenx-active-event-subscriber

Weekly Downloads

1

Version

0.0.22

License

ISC

Unpacked Size

10.8 kB

Total Files

8

Last publish

Collaborators

  • tobyt