@blux.ai/web-sdk 3.1.0 → 3.1.1
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/dist/package.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { combineLatest, distinctUntilChanged, fromEvent, map, merge, of, shareReplay, startWith } from "rxjs";
|
|
1
|
+
import { combineLatest, defer, distinctUntilChanged, fromEvent, map, merge, of, shareReplay, startWith } from "rxjs";
|
|
2
2
|
|
|
3
3
|
//#region src/utils/observables.ts
|
|
4
|
-
const visible$ = fromEvent(document, "visibilitychange").pipe(startWith(0), map(() => document.visibilityState === "visible"), distinctUntilChanged(), shareReplay({
|
|
4
|
+
const visible$ = defer(() => fromEvent(document, "visibilitychange")).pipe(startWith(0), map(() => document.visibilityState === "visible"), distinctUntilChanged(), shareReplay({
|
|
5
5
|
bufferSize: 1,
|
|
6
6
|
refCount: true
|
|
7
7
|
}));
|
|
8
|
-
const online$ = merge(fromEvent(window, "online").pipe(map(() => true)), fromEvent(window, "offline").pipe(map(() => false)), of(navigator.onLine)).pipe(distinctUntilChanged(), shareReplay({
|
|
8
|
+
const online$ = merge(defer(() => fromEvent(window, "online")).pipe(map(() => true)), defer(() => fromEvent(window, "offline")).pipe(map(() => false)), defer(() => of(navigator.onLine))).pipe(distinctUntilChanged(), shareReplay({
|
|
9
9
|
bufferSize: 1,
|
|
10
10
|
refCount: true
|
|
11
11
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observables.js","names":[],"sources":["../../src/utils/observables.ts"],"sourcesContent":["import {\n fromEvent,\n startWith,\n map,\n distinctUntilChanged,\n shareReplay,\n merge,\n of,\n combineLatest,\n} from \"rxjs\";\n\nconst visible$ = fromEvent(document, \"visibilitychange\").pipe(\n startWith(0),\n map(() => document.visibilityState === \"visible\"),\n distinctUntilChanged(),\n shareReplay({ bufferSize: 1, refCount: true }),\n);\n\nconst online$ = merge(\n fromEvent(window, \"online\").pipe(map(() => true)),\n fromEvent(window, \"offline\").pipe(map(() => false)),\n of(navigator.onLine),\n).pipe(distinctUntilChanged(), shareReplay({ bufferSize: 1, refCount: true }));\n\nexport const onlineAndVisible$ = combineLatest([visible$, online$]).pipe(\n map(([v, o]) => v && o),\n distinctUntilChanged(),\n shareReplay({ bufferSize: 1, refCount: true }),\n);\n"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"observables.js","names":[],"sources":["../../src/utils/observables.ts"],"sourcesContent":["import {\n defer,\n fromEvent,\n startWith,\n map,\n distinctUntilChanged,\n shareReplay,\n merge,\n of,\n combineLatest,\n} from \"rxjs\";\n\n// 서버에는 document·window가 없고, Node 20 이하에는 navigator도 없으므로 구독할 때 읽는다.\nconst visible$ = defer(() => fromEvent(document, \"visibilitychange\")).pipe(\n startWith(0),\n map(() => document.visibilityState === \"visible\"),\n distinctUntilChanged(),\n shareReplay({ bufferSize: 1, refCount: true }),\n);\n\nconst online$ = merge(\n defer(() => fromEvent(window, \"online\")).pipe(map(() => true)),\n defer(() => fromEvent(window, \"offline\")).pipe(map(() => false)),\n defer(() => of(navigator.onLine)),\n).pipe(distinctUntilChanged(), shareReplay({ bufferSize: 1, refCount: true }));\n\nexport const onlineAndVisible$ = combineLatest([visible$, online$]).pipe(\n map(([v, o]) => v && o),\n distinctUntilChanged(),\n shareReplay({ bufferSize: 1, refCount: true }),\n);\n"],"mappings":";;;AAaA,MAAM,WAAW,YAAY,UAAU,UAAU,kBAAkB,CAAC,CAAC,CAAC,KACpE,UAAU,CAAC,GACX,UAAU,SAAS,oBAAoB,SAAS,GAChD,qBAAqB,GACrB,YAAY;CAAE,YAAY;CAAG,UAAU;AAAK,CAAC,CAC/C;AAEA,MAAM,UAAU,MACd,YAAY,UAAU,QAAQ,QAAQ,CAAC,CAAC,CAAC,KAAK,UAAU,IAAI,CAAC,GAC7D,YAAY,UAAU,QAAQ,SAAS,CAAC,CAAC,CAAC,KAAK,UAAU,KAAK,CAAC,GAC/D,YAAY,GAAG,UAAU,MAAM,CAAC,CAClC,CAAC,CAAC,KAAK,qBAAqB,GAAG,YAAY;CAAE,YAAY;CAAG,UAAU;AAAK,CAAC,CAAC;AAE7E,MAAa,oBAAoB,cAAc,CAAC,UAAU,OAAO,CAAC,CAAC,CAAC,KAClE,KAAK,CAAC,GAAG,OAAO,KAAK,CAAC,GACtB,qBAAqB,GACrB,YAAY;CAAE,YAAY;CAAG,UAAU;AAAK,CAAC,CAC/C"}
|