@dropins/tools 0.21.2-alpha1 → 0.21.2-alpha2
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.
- package/event-bus.js +7 -7
- package/package.json +1 -1
package/event-bus.js
CHANGED
|
@@ -17,10 +17,10 @@ export const id=248;export const ids=[248];export const modules={
|
|
|
17
17
|
/**
|
|
18
18
|
* Subscribes to an event.
|
|
19
19
|
*
|
|
20
|
-
* @param event - The name of the event to subscribe to.
|
|
21
|
-
* @param handler - The function to call when the event is emitted.
|
|
22
|
-
* @param options - An optional object with additional options.
|
|
23
|
-
* @param options.eager - If true, the handler will be called immediately with the last emitted event.
|
|
20
|
+
* @param {string} event - The name of the event to subscribe to.
|
|
21
|
+
* @param {Function} handler - The function to call when the event is emitted.
|
|
22
|
+
* @param {Object} [options] - An optional object with additional options.
|
|
23
|
+
* @param {boolean} [options.eager] - If true, the handler will be called immediately with the last emitted event.
|
|
24
24
|
*/
|
|
25
25
|
static on(e,t,n){if("undefined"!=typeof BroadcastChannel){var i=new BroadcastChannel("ElsieSDK/EventBus");if(null!=n&&n.eager){var r=this._lastEvent[e];r&&t(r.payload)}return i.addEventListener("message",(n=>{var{data:i}=n;
|
|
26
26
|
// ignore events from other instances (only if identifier is set)
|
|
@@ -30,13 +30,13 @@ window.addEventListener("beforeunload",(()=>{i.close()})),{off(){i.close()}}}}
|
|
|
30
30
|
/**
|
|
31
31
|
* Emits an event.
|
|
32
32
|
*
|
|
33
|
-
* @param event - The name of the event to emit.
|
|
34
|
-
* @param payload - The data to send with the event.
|
|
33
|
+
* @param {string} event - The name of the event to emit.
|
|
34
|
+
* @param {*} payload - The data to send with the event.
|
|
35
35
|
*/static emit(e,t){if("undefined"!=typeof BroadcastChannel){var n=new BroadcastChannel("ElsieSDK/EventBus");n.postMessage({event:e,identifier:this._identifier,payload:t}),this._lastEvent[e]={payload:t},n.close()}}
|
|
36
36
|
/**
|
|
37
37
|
* Enables or disables logging of events.
|
|
38
38
|
*
|
|
39
|
-
* @param enabled - If true, events will be logged to the console.
|
|
39
|
+
* @param {boolean} enabled - If true, events will be logged to the console.
|
|
40
40
|
*/static enableLogger(e){var t;"undefined"!=typeof BroadcastChannel&&(
|
|
41
41
|
// reset logger
|
|
42
42
|
null===(t=this._logger)||void 0===t||t.close(),this._logger=null,!1!==e&&(
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name": "@dropins/tools", "version": "0.21.2-
|
|
1
|
+
{"name": "@dropins/tools", "version": "0.21.2-alpha2"}
|