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.
Files changed (3) hide show
  1. package/index.cjs +3 -2
  2. package/index.js +3 -2
  3. 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);},h=new BroadcastChannel(d.channel);let i=!0,j=null;return null===j&&(e=new rxjs.BehaviorSubject({}),j=new Presence__default["default"]("https://prsc.yomo.dev",{auth:{// Certification Type
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"}}),j.on("connected",()=>{console.log("Connected to server: ",j.host);})),j.on("connected",()=>{j.on("updateData",b=>{console.log("data :",b),i=!1,a.update(a=>Object.assign(Object.assign({},a),b));}),j.on("online",a=>{console.log("online: ",a);});}),j.on("connected",()=>{f().subscribe(a=>{j.send("updateData",a);});}),d.source(a).pipe(rxjs.skip(1),rxjs.distinctUntilChanged(lodashEs.isEqual),rxjs.tap(a=>{i?(h.postMessage(a),console.log("PostMessage: ",a),g(a),j.on("connected",()=>{j.send("online",a);})):i=!0;}),rxjs.finalize(()=>h.close())).subscribe(),h}
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);},h=new BroadcastChannel(d.channel);let i=!0,j=null;return null===j&&(e=new BehaviorSubject({}),j=new Presence("https://prsc.yomo.dev",{auth:{// Certification Type
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"}}),j.on("connected",()=>{console.log("Connected to server: ",j.host);})),j.on("connected",()=>{j.on("updateData",b=>{console.log("data :",b),i=!1,a.update(a=>Object.assign(Object.assign({},a),b));}),j.on("online",a=>{console.log("online: ",a);});}),j.on("connected",()=>{f().subscribe(a=>{j.send("updateData",a);});}),d.source(a).pipe(skip(1),distinctUntilChanged(isEqual),tap(a=>{i?(h.postMessage(a),console.log("PostMessage: ",a),g(a),j.on("connected",()=>{j.send("online",a);})):i=!0;}),finalize(()=>h.close())).subscribe(),h}
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elf-sync-state-yomo",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "Syncs elf store state across tabs",
5
5
  "publishConfig": {
6
6
  "access": "public"