@dereekb/browser 13.4.0 → 13.4.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 +12 -2
- package/index.esm.js +12 -2
- package/package.json +3 -3
- package/src/lib/service.d.ts +4 -0
- package/src/lib/type.d.ts +3 -1
- package/src/lib/vh100.d.ts +2 -0
- package/src/lib/window.d.ts +2 -0
package/index.cjs.js
CHANGED
|
@@ -5,7 +5,9 @@ var rxjs$1 = require('@dereekb/rxjs');
|
|
|
5
5
|
var rxjs = require('rxjs');
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Creates a new BrowserObjectURLRef.
|
|
9
|
+
*
|
|
10
|
+
* @returns A new BrowserObjectURLRef instance that manages browser object URL lifecycle
|
|
9
11
|
*/ function browserObjectUrlRef() {
|
|
10
12
|
var browserUrl;
|
|
11
13
|
/**
|
|
@@ -209,7 +211,7 @@ function _ts_generator(thisArg, body) {
|
|
|
209
211
|
/**
|
|
210
212
|
* Observable that emits the loading promise. Subscribing triggers the initial load if not already started.
|
|
211
213
|
*/ _define_property(this, "loading$", this._loading.pipe(rxjs$1.tapFirst(function() {
|
|
212
|
-
|
|
214
|
+
void _this.loadService();
|
|
213
215
|
}), rxjs$1.filterMaybe(), rxjs.shareReplay(1)));
|
|
214
216
|
/**
|
|
215
217
|
* Observable that emits the resolved service instance once loading completes. Replays the last value to new subscribers.
|
|
@@ -240,6 +242,8 @@ function _ts_generator(thisArg, body) {
|
|
|
240
242
|
* Returns a promise that resolves with the loaded service instance.
|
|
241
243
|
*
|
|
242
244
|
* Triggers loading if not already started.
|
|
245
|
+
*
|
|
246
|
+
* @returns Promise that resolves with the loaded service instance
|
|
243
247
|
*/ key: "getService",
|
|
244
248
|
value: function getService() {
|
|
245
249
|
return rxjs.firstValueFrom(this.service$);
|
|
@@ -350,6 +354,8 @@ function _ts_generator(thisArg, body) {
|
|
|
350
354
|
/**
|
|
351
355
|
* Hook called before completing the service load. Subclasses can override to perform
|
|
352
356
|
* additional async setup before the service reference is read from `window`.
|
|
357
|
+
*
|
|
358
|
+
* @returns Promise that resolves when pre-load setup is complete
|
|
353
359
|
*/ key: "_prepareCompleteLoadingService",
|
|
354
360
|
value: function _prepareCompleteLoadingService() {
|
|
355
361
|
return Promise.resolve();
|
|
@@ -401,6 +407,8 @@ function _ts_generator(thisArg, body) {
|
|
|
401
407
|
}
|
|
402
408
|
/**
|
|
403
409
|
* Adds window event listeners to populate the css variable `vh100`, or another input variable name, with the current window height.
|
|
410
|
+
*
|
|
411
|
+
* @param cssVariableName - Name of the CSS custom property to update; defaults to `vh100`
|
|
404
412
|
*/ function watchWindowAndUpdateVh100StyleProperty(cssVariableName) {
|
|
405
413
|
var refreshPropertyValue = refreshVh100Function(cssVariableName);
|
|
406
414
|
window.addEventListener('resize', refreshPropertyValue);
|
|
@@ -411,6 +419,8 @@ function _ts_generator(thisArg, body) {
|
|
|
411
419
|
// MARK: Window Location Utiltiies
|
|
412
420
|
/**
|
|
413
421
|
* Whether or not the current host is localhost. Useful for determining local dev environments.
|
|
422
|
+
*
|
|
423
|
+
* @returns True if the current hostname is `localhost`
|
|
414
424
|
*/ function isLocalhost() {
|
|
415
425
|
return window.location.hostname === 'localhost';
|
|
416
426
|
}
|
package/index.esm.js
CHANGED
|
@@ -3,7 +3,9 @@ import { tapFirst, filterMaybe } from '@dereekb/rxjs';
|
|
|
3
3
|
import { BehaviorSubject, shareReplay, switchMap, from, firstValueFrom } from 'rxjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Creates a new BrowserObjectURLRef.
|
|
7
|
+
*
|
|
8
|
+
* @returns A new BrowserObjectURLRef instance that manages browser object URL lifecycle
|
|
7
9
|
*/ function browserObjectUrlRef() {
|
|
8
10
|
var browserUrl;
|
|
9
11
|
/**
|
|
@@ -207,7 +209,7 @@ function _ts_generator(thisArg, body) {
|
|
|
207
209
|
/**
|
|
208
210
|
* Observable that emits the loading promise. Subscribing triggers the initial load if not already started.
|
|
209
211
|
*/ _define_property(this, "loading$", this._loading.pipe(tapFirst(function() {
|
|
210
|
-
|
|
212
|
+
void _this.loadService();
|
|
211
213
|
}), filterMaybe(), shareReplay(1)));
|
|
212
214
|
/**
|
|
213
215
|
* Observable that emits the resolved service instance once loading completes. Replays the last value to new subscribers.
|
|
@@ -238,6 +240,8 @@ function _ts_generator(thisArg, body) {
|
|
|
238
240
|
* Returns a promise that resolves with the loaded service instance.
|
|
239
241
|
*
|
|
240
242
|
* Triggers loading if not already started.
|
|
243
|
+
*
|
|
244
|
+
* @returns Promise that resolves with the loaded service instance
|
|
241
245
|
*/ key: "getService",
|
|
242
246
|
value: function getService() {
|
|
243
247
|
return firstValueFrom(this.service$);
|
|
@@ -348,6 +352,8 @@ function _ts_generator(thisArg, body) {
|
|
|
348
352
|
/**
|
|
349
353
|
* Hook called before completing the service load. Subclasses can override to perform
|
|
350
354
|
* additional async setup before the service reference is read from `window`.
|
|
355
|
+
*
|
|
356
|
+
* @returns Promise that resolves when pre-load setup is complete
|
|
351
357
|
*/ key: "_prepareCompleteLoadingService",
|
|
352
358
|
value: function _prepareCompleteLoadingService() {
|
|
353
359
|
return Promise.resolve();
|
|
@@ -399,6 +405,8 @@ function _ts_generator(thisArg, body) {
|
|
|
399
405
|
}
|
|
400
406
|
/**
|
|
401
407
|
* Adds window event listeners to populate the css variable `vh100`, or another input variable name, with the current window height.
|
|
408
|
+
*
|
|
409
|
+
* @param cssVariableName - Name of the CSS custom property to update; defaults to `vh100`
|
|
402
410
|
*/ function watchWindowAndUpdateVh100StyleProperty(cssVariableName) {
|
|
403
411
|
var refreshPropertyValue = refreshVh100Function(cssVariableName);
|
|
404
412
|
window.addEventListener('resize', refreshPropertyValue);
|
|
@@ -409,6 +417,8 @@ function _ts_generator(thisArg, body) {
|
|
|
409
417
|
// MARK: Window Location Utiltiies
|
|
410
418
|
/**
|
|
411
419
|
* Whether or not the current host is localhost. Useful for determining local dev environments.
|
|
420
|
+
*
|
|
421
|
+
* @returns True if the current hostname is `localhost`
|
|
412
422
|
*/ function isLocalhost() {
|
|
413
423
|
return window.location.hostname === 'localhost';
|
|
414
424
|
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/browser",
|
|
3
|
-
"version": "13.4.
|
|
3
|
+
"version": "13.4.2",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@dereekb/util": "13.4.
|
|
6
|
-
"@dereekb/rxjs": "13.4.
|
|
5
|
+
"@dereekb/util": "13.4.2",
|
|
6
|
+
"@dereekb/rxjs": "13.4.2",
|
|
7
7
|
"rxjs": "^7.8.0"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {},
|
package/src/lib/service.d.ts
CHANGED
|
@@ -48,6 +48,8 @@ export declare abstract class AbstractAsyncWindowLoadedService<T> implements Des
|
|
|
48
48
|
* Returns a promise that resolves with the loaded service instance.
|
|
49
49
|
*
|
|
50
50
|
* Triggers loading if not already started.
|
|
51
|
+
*
|
|
52
|
+
* @returns Promise that resolves with the loaded service instance
|
|
51
53
|
*/
|
|
52
54
|
getService(): Promise<T>;
|
|
53
55
|
/**
|
|
@@ -71,6 +73,8 @@ export declare abstract class AbstractAsyncWindowLoadedService<T> implements Des
|
|
|
71
73
|
/**
|
|
72
74
|
* Hook called before completing the service load. Subclasses can override to perform
|
|
73
75
|
* additional async setup before the service reference is read from `window`.
|
|
76
|
+
*
|
|
77
|
+
* @returns Promise that resolves when pre-load setup is complete
|
|
74
78
|
*/
|
|
75
79
|
protected _prepareCompleteLoadingService(): Promise<unknown>;
|
|
76
80
|
/**
|
package/src/lib/type.d.ts
CHANGED
|
@@ -23,6 +23,8 @@ export interface BrowserObjectURLRef extends Destroyable {
|
|
|
23
23
|
createBrowserUrl(input?: Maybe<Blob | MediaSource>): Maybe<BrowserObjectURL>;
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* Creates a new BrowserObjectURLRef.
|
|
27
|
+
*
|
|
28
|
+
* @returns A new BrowserObjectURLRef instance that manages browser object URL lifecycle
|
|
27
29
|
*/
|
|
28
30
|
export declare function browserObjectUrlRef(): BrowserObjectURLRef;
|
package/src/lib/vh100.d.ts
CHANGED
|
@@ -20,5 +20,7 @@ export declare const DEFAULT_VH100_VARIABLE_NAME = "vh100";
|
|
|
20
20
|
export declare function refreshVh100Function(cssVariableName?: string): () => void;
|
|
21
21
|
/**
|
|
22
22
|
* Adds window event listeners to populate the css variable `vh100`, or another input variable name, with the current window height.
|
|
23
|
+
*
|
|
24
|
+
* @param cssVariableName - Name of the CSS custom property to update; defaults to `vh100`
|
|
23
25
|
*/
|
|
24
26
|
export declare function watchWindowAndUpdateVh100StyleProperty(cssVariableName?: string): void;
|