@xibosignage/xibo-communication-framework 0.0.7 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,6 +17,9 @@ interface XmrEvents {
17
17
  }[]) => void;
18
18
  commandCodeReceived: (commandCode: string) => void;
19
19
  dataUpdate: (widgetId: number) => void;
20
+ purgeAll: () => void;
21
+ clearStatsAndLogs: () => void;
22
+ triggerWebhook: (triggerCode: string) => void;
20
23
  }
21
24
  declare class Xmr {
22
25
  emitter: Emitter<XmrEvents>;
@@ -27,7 +30,7 @@ declare class Xmr {
27
30
  isConnectionWanted: boolean;
28
31
  isConnected: boolean;
29
32
  lastMessageAt: DateTime;
30
- interval: NodeJS.Timeout | undefined;
33
+ interval: ReturnType<typeof setInterval> | null;
31
34
  constructor(channel: string);
32
35
  on<E extends keyof XmrEvents>(event: E, callback: XmrEvents[E]): nanoevents.Unsubscribe;
33
36
  init(): Promise<void>;
@@ -8336,7 +8336,7 @@ var Xmr = /*#__PURE__*/function () {
8336
8336
  _defineProperty(this, "isConnectionWanted", void 0);
8337
8337
  _defineProperty(this, "isConnected", void 0);
8338
8338
  _defineProperty(this, "lastMessageAt", void 0);
8339
- _defineProperty(this, "interval", void 0);
8339
+ _defineProperty(this, "interval", null);
8340
8340
  // Emitter
8341
8341
  this.emitter = createNanoEvents();
8342
8342
  this.url = null;
@@ -8490,6 +8490,7 @@ var Xmr = /*#__PURE__*/function () {
8490
8490
  // JSON message.
8491
8491
  var message = JSON.parse(event.data);
8492
8492
  console.debug('Xmr::message: action is ' + message.action);
8493
+ console.debug('Xmr::message', message);
8493
8494
  // Check the createdDt and TTL against the current date time.
8494
8495
  var expiresAt = DateTime.fromISO(message.createdDt).plus({
8495
8496
  seconds: parseInt(message.ttl)
@@ -8508,6 +8509,12 @@ var Xmr = /*#__PURE__*/function () {
8508
8509
  _this2.emitter.emit('commandCodeReceived', message.commandCode);
8509
8510
  } else if (message.action == 'dataUpdate') {
8510
8511
  _this2.emitter.emit('dataUpdate', message.widgetId);
8512
+ } else if (message.action == 'purgeAll') {
8513
+ _this2.emitter.emit('purgeAll');
8514
+ } else if (message.action == 'clearStatsAndLogs') {
8515
+ _this2.emitter.emit('clearStatsAndLogs');
8516
+ } else if (message.action == 'triggerWebhook') {
8517
+ _this2.emitter.emit('triggerWebhook', message.triggerCode);
8511
8518
  } else {
8512
8519
  console.error('Xmr::message: unknown action: ' + message.action);
8513
8520
  }