@dereekb/browser 11.0.1 → 11.0.2
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/index.cjs.js +16 -7
- package/index.esm.js +18 -6
- package/package.json +1 -1
- package/src/lib/service.d.ts +16 -7
package/index.cjs.js
CHANGED
|
@@ -2245,19 +2245,28 @@ function _call(body, then, direct) {
|
|
|
2245
2245
|
}
|
|
2246
2246
|
class AbstractAsyncWindowLoadedService {
|
|
2247
2247
|
/**
|
|
2248
|
-
* @param
|
|
2249
|
-
* @param
|
|
2248
|
+
* @param windowKey
|
|
2249
|
+
* @param callbackKey
|
|
2250
2250
|
*/
|
|
2251
|
-
constructor(
|
|
2251
|
+
constructor(windowKey, callbackKey, serviceName, preload) {
|
|
2252
|
+
this._loading = new rxjs.BehaviorSubject(undefined);
|
|
2253
|
+
/**
|
|
2254
|
+
* Key that is attached to the window for the object that is the service when finished loading.
|
|
2255
|
+
*/
|
|
2252
2256
|
this._windowKey = void 0;
|
|
2257
|
+
/**
|
|
2258
|
+
* Optional key attached to window that is a function that is executed when the setup is complete.
|
|
2259
|
+
*/
|
|
2253
2260
|
this._callbackKey = void 0;
|
|
2261
|
+
/**
|
|
2262
|
+
* Service name used in logging. Defaults to the windowKey.
|
|
2263
|
+
*/
|
|
2254
2264
|
this._serviceName = void 0;
|
|
2255
|
-
this._loading = new rxjs.BehaviorSubject(undefined);
|
|
2256
2265
|
this.loading$ = this._loading.pipe(rxjs$1.tapFirst(() => this.loadService()), rxjs$1.filterMaybe(), rxjs.shareReplay(1));
|
|
2257
2266
|
this.service$ = this.loading$.pipe(rxjs.switchMap(x => rxjs.from(x)), rxjs.shareReplay(1));
|
|
2258
|
-
this._windowKey =
|
|
2259
|
-
this._callbackKey =
|
|
2260
|
-
this._serviceName =
|
|
2267
|
+
this._windowKey = windowKey;
|
|
2268
|
+
this._callbackKey = callbackKey;
|
|
2269
|
+
this._serviceName = serviceName != null ? serviceName : windowKey;
|
|
2261
2270
|
if (preload) {
|
|
2262
2271
|
// Begin loading the service immediately.
|
|
2263
2272
|
setTimeout(() => this.loadService().catch());
|
package/index.esm.js
CHANGED
|
@@ -2220,16 +2220,28 @@ $$1({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
|
|
|
2220
2220
|
*/
|
|
2221
2221
|
class AbstractAsyncWindowLoadedService {
|
|
2222
2222
|
/**
|
|
2223
|
-
* @param
|
|
2224
|
-
* @param
|
|
2223
|
+
* @param windowKey
|
|
2224
|
+
* @param callbackKey
|
|
2225
2225
|
*/
|
|
2226
|
-
constructor(
|
|
2227
|
-
this._windowKey = _windowKey;
|
|
2228
|
-
this._callbackKey = _callbackKey;
|
|
2229
|
-
this._serviceName = _serviceName;
|
|
2226
|
+
constructor(windowKey, callbackKey, serviceName, preload) {
|
|
2230
2227
|
this._loading = new BehaviorSubject(undefined);
|
|
2228
|
+
/**
|
|
2229
|
+
* Key that is attached to the window for the object that is the service when finished loading.
|
|
2230
|
+
*/
|
|
2231
|
+
this._windowKey = void 0;
|
|
2232
|
+
/**
|
|
2233
|
+
* Optional key attached to window that is a function that is executed when the setup is complete.
|
|
2234
|
+
*/
|
|
2235
|
+
this._callbackKey = void 0;
|
|
2236
|
+
/**
|
|
2237
|
+
* Service name used in logging. Defaults to the windowKey.
|
|
2238
|
+
*/
|
|
2239
|
+
this._serviceName = void 0;
|
|
2231
2240
|
this.loading$ = this._loading.pipe(tapFirst(() => this.loadService()), filterMaybe(), shareReplay(1));
|
|
2232
2241
|
this.service$ = this.loading$.pipe(switchMap(x => from(x)), shareReplay(1));
|
|
2242
|
+
this._windowKey = windowKey;
|
|
2243
|
+
this._callbackKey = callbackKey;
|
|
2244
|
+
this._serviceName = serviceName != null ? serviceName : windowKey;
|
|
2233
2245
|
if (preload) {
|
|
2234
2246
|
// Begin loading the service immediately.
|
|
2235
2247
|
setTimeout(() => this.loadService().catch());
|
package/package.json
CHANGED
package/src/lib/service.d.ts
CHANGED
|
@@ -6,17 +6,26 @@ export type ServiceCallbackInWindow = Record<string, () => void>;
|
|
|
6
6
|
* Used for loading services in the browser that are imported from other scripts, such as Facebook, Segment, Stripe, etc.
|
|
7
7
|
*/
|
|
8
8
|
export declare abstract class AbstractAsyncWindowLoadedService<T> implements Destroyable {
|
|
9
|
-
private
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
private readonly _loading;
|
|
10
|
+
/**
|
|
11
|
+
* Key that is attached to the window for the object that is the service when finished loading.
|
|
12
|
+
*/
|
|
13
|
+
private readonly _windowKey;
|
|
14
|
+
/**
|
|
15
|
+
* Optional key attached to window that is a function that is executed when the setup is complete.
|
|
16
|
+
*/
|
|
17
|
+
private readonly _callbackKey?;
|
|
18
|
+
/**
|
|
19
|
+
* Service name used in logging. Defaults to the windowKey.
|
|
20
|
+
*/
|
|
21
|
+
private readonly _serviceName;
|
|
13
22
|
readonly loading$: Observable<Promise<T>>;
|
|
14
23
|
readonly service$: Observable<T>;
|
|
15
24
|
/**
|
|
16
|
-
* @param
|
|
17
|
-
* @param
|
|
25
|
+
* @param windowKey
|
|
26
|
+
* @param callbackKey
|
|
18
27
|
*/
|
|
19
|
-
constructor(
|
|
28
|
+
constructor(windowKey: string, callbackKey?: string, serviceName?: Maybe<string>, preload?: Maybe<boolean>);
|
|
20
29
|
destroy(): void;
|
|
21
30
|
getService(): Promise<T>;
|
|
22
31
|
protected loadService(): Promise<T>;
|