@dropins/tools 0.21.2-alpha1 → 0.21.2-alpha3
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/initializer.js +7 -4
- package/lib/initializer.d.ts +7 -4
- package/lib/initializer.d.ts.map +1 -1
- package/lib/initializer.js +7 -4
- 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/initializer.js
CHANGED
|
@@ -28,7 +28,7 @@ constructor(t){var{init:e,listeners:r}=t;p(this,"_listeners",[]),p(this,"config"
|
|
|
28
28
|
// Unbind existing listeners
|
|
29
29
|
this._listeners.forEach((t=>t.off())),this._listeners=r(t)),this.init=t=>{var r=t,{imageParamsKeyMap:i}=r,n=u(r,o);return this.config.setConfig(c(c({},this.config.getConfig()),n)),s(i),e(t)}}}
|
|
30
30
|
/**
|
|
31
|
-
* Class representing
|
|
31
|
+
* Class representing initializerss.
|
|
32
32
|
*
|
|
33
33
|
* @class
|
|
34
34
|
*
|
|
@@ -39,12 +39,14 @@ this._listeners.forEach((t=>t.off())),this._listeners=r(t)),this.init=t=>{var r=
|
|
|
39
39
|
/**
|
|
40
40
|
* Registers a new initializer.
|
|
41
41
|
*
|
|
42
|
-
* @param initializer - The initializer to register. This should be an object with `listeners` and `init` methods.
|
|
43
|
-
* @param options - An optional object with additional options. These options are passed to the `listeners` and `init` methods of the initializer.
|
|
42
|
+
* @param {Initializer<any>} initializer - The initializer to register. This should be an object with `listeners` and `init` methods.
|
|
43
|
+
* @param {Object.<string, any>} [options] - An optional object with additional options. These options are passed to the `listeners` and `init` methods of the initializer.
|
|
44
44
|
*/
|
|
45
45
|
static register(t,e){var r,i;m._mounted&&(null===(r=t.listeners)||void 0===r||r.call(t,e),null===(i=t.init)||void 0===i||i.call(t,e));m._initializers.push([t,e])}
|
|
46
46
|
/**
|
|
47
47
|
* Mounts all registered initializers.
|
|
48
|
+
*
|
|
49
|
+
* @returns {void}
|
|
48
50
|
*/static mount(){var t,e;m._mounted=!0,
|
|
49
51
|
// In this specific order
|
|
50
52
|
// 1. Bind events
|
|
@@ -54,7 +56,8 @@ null===(e=m._initializers)||void 0===e||e.forEach((t=>{var e,[r,i]=t;null===(e=r
|
|
|
54
56
|
/**
|
|
55
57
|
* Sets the image parameter keys.
|
|
56
58
|
*
|
|
57
|
-
* @param params - An object mapping keys to values.
|
|
59
|
+
* @param {Object.<string, any>} params - An object mapping keys to values.
|
|
60
|
+
* @returns {void}
|
|
58
61
|
*/static setImageParamKeys(t){m._imageParamsKeyMap=t}}p(m,"_initializers",[]),p(m,"_mounted",!1),p(m,"_imageParamsKeyMap",void 0)}
|
|
59
62
|
/***/};
|
|
60
63
|
// load runtime
|
package/lib/initializer.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ type Initializers = [Initializer<any>, {
|
|
|
38
38
|
[key: string]: any;
|
|
39
39
|
} | undefined][];
|
|
40
40
|
/**
|
|
41
|
-
* Class representing
|
|
41
|
+
* Class representing initializerss.
|
|
42
42
|
*
|
|
43
43
|
* @class
|
|
44
44
|
*
|
|
@@ -55,20 +55,23 @@ export declare class initializers {
|
|
|
55
55
|
/**
|
|
56
56
|
* Registers a new initializer.
|
|
57
57
|
*
|
|
58
|
-
* @param initializer - The initializer to register. This should be an object with `listeners` and `init` methods.
|
|
59
|
-
* @param options - An optional object with additional options. These options are passed to the `listeners` and `init` methods of the initializer.
|
|
58
|
+
* @param {Initializer<any>} initializer - The initializer to register. This should be an object with `listeners` and `init` methods.
|
|
59
|
+
* @param {Object.<string, any>} [options] - An optional object with additional options. These options are passed to the `listeners` and `init` methods of the initializer.
|
|
60
60
|
*/
|
|
61
61
|
static register(initializer: Initializer<any>, options?: {
|
|
62
62
|
[key: string]: any;
|
|
63
63
|
}): void;
|
|
64
64
|
/**
|
|
65
65
|
* Mounts all registered initializers.
|
|
66
|
+
*
|
|
67
|
+
* @returns {void}
|
|
66
68
|
*/
|
|
67
69
|
static mount(): void;
|
|
68
70
|
/**
|
|
69
71
|
* Sets the image parameter keys.
|
|
70
72
|
*
|
|
71
|
-
* @param params - An object mapping keys to values.
|
|
73
|
+
* @param {Object.<string, any>} params - An object mapping keys to values.
|
|
74
|
+
* @returns {void}
|
|
72
75
|
*/
|
|
73
76
|
static setImageParamKeys(params: {
|
|
74
77
|
[key: string]: any;
|
package/lib/initializer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initializer.d.ts","sourceRoot":"","sources":["../../src/lib/initializer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAwB,MAAM,kBAAkB,CAAC;AAEhE,KAAK,QAAQ,GAAG;IAAE,GAAG,IAAI,IAAI,CAAA;CAAE,CAAC;AAEhC,KAAK,SAAS,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,KAAK,CAAC,QAAQ,GAAG,SAAS,CAAC,CAAC;AAEhE,KAAK,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAE7C,KAAK,OAAO,CAAC,CAAC,IAAI;IAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,CAAA;CAAE,CAAC;AAE7D;;;;;;;;;;;GAWG;AAEH,qBAAa,WAAW,CAAC,CAAC;IACxB,OAAO,CAAC,UAAU,CAAkB;IACpC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IACxB,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IACd,MAAM,YAA4B;IAElC;;;;;;OAMG;gBACS,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC;CAe5C;AAED,KAAK,YAAY,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE;IAAE,CAAC,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,YAA4B;IAElC;;;;;;OAMG;gBACS,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC;CAe5C;AAED,KAAK,YAAY,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,GAAG,SAAS,CAAC,EAAE,CAAC;AAE7E;;;;;;;;GAQG;AACH,qBAAa,YAAY;IACvB,MAAM,CAAC,aAAa,EAAE,YAAY,CAAM;IACxC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAS;IACjC,MAAM,CAAC,kBAAkB,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,GAAG,SAAS,CAAa;IAE7E;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CACb,WAAW,EAAE,WAAW,CAAC,GAAG,CAAC,EAC7B,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE;IASlC;;;;OAIG;IACH,MAAM,CAAC,KAAK;IAiBZ;;;;;OAKG;IACH,MAAM,CAAC,iBAAiB,CAAC,MAAM,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE;CAGxD"}
|
package/lib/initializer.js
CHANGED
|
@@ -39,7 +39,7 @@ export class Initializer {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
|
-
* Class representing
|
|
42
|
+
* Class representing initializerss.
|
|
43
43
|
*
|
|
44
44
|
* @class
|
|
45
45
|
*
|
|
@@ -54,8 +54,8 @@ export class initializers {
|
|
|
54
54
|
/**
|
|
55
55
|
* Registers a new initializer.
|
|
56
56
|
*
|
|
57
|
-
* @param initializer - The initializer to register. This should be an object with `listeners` and `init` methods.
|
|
58
|
-
* @param options - An optional object with additional options. These options are passed to the `listeners` and `init` methods of the initializer.
|
|
57
|
+
* @param {Initializer<any>} initializer - The initializer to register. This should be an object with `listeners` and `init` methods.
|
|
58
|
+
* @param {Object.<string, any>} [options] - An optional object with additional options. These options are passed to the `listeners` and `init` methods of the initializer.
|
|
59
59
|
*/
|
|
60
60
|
static register(initializer, options) {
|
|
61
61
|
if (initializers._mounted) {
|
|
@@ -66,6 +66,8 @@ export class initializers {
|
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
68
|
* Mounts all registered initializers.
|
|
69
|
+
*
|
|
70
|
+
* @returns {void}
|
|
69
71
|
*/
|
|
70
72
|
static mount() {
|
|
71
73
|
initializers._mounted = true;
|
|
@@ -85,7 +87,8 @@ export class initializers {
|
|
|
85
87
|
/**
|
|
86
88
|
* Sets the image parameter keys.
|
|
87
89
|
*
|
|
88
|
-
* @param params - An object mapping keys to values.
|
|
90
|
+
* @param {Object.<string, any>} params - An object mapping keys to values.
|
|
91
|
+
* @returns {void}
|
|
89
92
|
*/
|
|
90
93
|
static setImageParamKeys(params) {
|
|
91
94
|
initializers._imageParamsKeyMap = params;
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name": "@dropins/tools", "version": "0.21.2-
|
|
1
|
+
{"name": "@dropins/tools", "version": "0.21.2-alpha3"}
|