elf-sync-state-yomo 1.0.8 → 1.0.9
Sign up to get free protection for your applications and to get access to all the features.
- package/index.cjs +3 -2
- package/index.js +3 -2
- package/package.json +1 -1
package/index.cjs
CHANGED
@@ -10,9 +10,10 @@
|
|
10
10
|
|
11
11
|
function includeKeys(a){return rxjs.pipe(operators.map(b=>Object.keys(b).reduce((c,d)=>(a.includes(d)&&(c[d]=b[d]),c),{})))}
|
12
12
|
|
13
|
-
function syncState(a,b){const c={channel:`${a.name}@store`,source:a=>a.asObservable(),preUpdate:a=>a.data,runGuard:()=>"undefined"!=typeof window&&"undefined"!=typeof window.BroadcastChannel},d=Object.assign(Object.assign({},c),b);if(!d.runGuard())return;let e;const f=()=>e.asObservable(),g=a=>{e.next(a);}
|
13
|
+
function syncState(a,b){const c={channel:`${a.name}@store`,source:a=>a.asObservable(),preUpdate:a=>a.data,runGuard:()=>"undefined"!=typeof window&&"undefined"!=typeof window.BroadcastChannel},d=Object.assign(Object.assign({},c),b);if(!d.runGuard())return;let e;const f=()=>e.asObservable(),g=a=>{e.next(a);};// const stateChannel = new BroadcastChannel(merged.channel);
|
14
|
+
let h=!0,i=null;return null===i&&(e=new rxjs.BehaviorSubject({}),i=new Presence__default["default"]("https://prsc.yomo.dev",{auth:{// Certification Type
|
14
15
|
type:"token",// Api for getting access token
|
15
|
-
endpoint:"https://ae59-159-146-14-53.ngrok.io/api/presence-auth"}}),
|
16
|
+
endpoint:"https://ae59-159-146-14-53.ngrok.io/api/presence-auth"}}),i.on("connected",()=>{console.log("Connected to server: ",i.host);})),i.on("connected",()=>{i.on("updateData",b=>{console.log("data :",b),h=!1,a.update(a=>Object.assign(Object.assign({},a),b));});}),i.on("connected",()=>{f().subscribe(a=>{i.send("updateData",a);});}),d.source(a).pipe(rxjs.skip(1),rxjs.distinctUntilChanged(lodashEs.isEqual),rxjs.tap(a=>{h?(console.log("PostMessage: ",a),g(a)):h=!0;}),rxjs.finalize(()=>{i.close(),i.on("closed",()=>{console.log("Closed the connection");});})).subscribe(),i}
|
16
17
|
|
17
18
|
exports.includeKeys = includeKeys;
|
18
19
|
exports.syncState = syncState;
|
package/index.js
CHANGED
@@ -5,8 +5,9 @@ import Presence from '@yomo/presencejs';
|
|
5
5
|
|
6
6
|
function includeKeys(a){return pipe(map(b=>Object.keys(b).reduce((c,d)=>(a.includes(d)&&(c[d]=b[d]),c),{})))}
|
7
7
|
|
8
|
-
function syncState(a,b){const c={channel:`${a.name}@store`,source:a=>a.asObservable(),preUpdate:a=>a.data,runGuard:()=>"undefined"!=typeof window&&"undefined"!=typeof window.BroadcastChannel},d=Object.assign(Object.assign({},c),b);if(!d.runGuard())return;let e;const f=()=>e.asObservable(),g=a=>{e.next(a);}
|
8
|
+
function syncState(a,b){const c={channel:`${a.name}@store`,source:a=>a.asObservable(),preUpdate:a=>a.data,runGuard:()=>"undefined"!=typeof window&&"undefined"!=typeof window.BroadcastChannel},d=Object.assign(Object.assign({},c),b);if(!d.runGuard())return;let e;const f=()=>e.asObservable(),g=a=>{e.next(a);};// const stateChannel = new BroadcastChannel(merged.channel);
|
9
|
+
let h=!0,i=null;return null===i&&(e=new BehaviorSubject({}),i=new Presence("https://prsc.yomo.dev",{auth:{// Certification Type
|
9
10
|
type:"token",// Api for getting access token
|
10
|
-
endpoint:"https://ae59-159-146-14-53.ngrok.io/api/presence-auth"}}),
|
11
|
+
endpoint:"https://ae59-159-146-14-53.ngrok.io/api/presence-auth"}}),i.on("connected",()=>{console.log("Connected to server: ",i.host);})),i.on("connected",()=>{i.on("updateData",b=>{console.log("data :",b),h=!1,a.update(a=>Object.assign(Object.assign({},a),b));});}),i.on("connected",()=>{f().subscribe(a=>{i.send("updateData",a);});}),d.source(a).pipe(skip(1),distinctUntilChanged(isEqual),tap(a=>{h?(console.log("PostMessage: ",a),g(a)):h=!0;}),finalize(()=>{i.close(),i.on("closed",()=>{console.log("Closed the connection");});})).subscribe(),i}
|
11
12
|
|
12
13
|
export { includeKeys, syncState };
|