diff --git a/src/index.ts b/src/index.ts index 7478d82..88fdb8b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,22 +1,9 @@ import { topic } from "./topics/topic" import { leader } from "./tabs/leader" -import { Observable } from "rx" function start(f: () => void = () => {}) { leader(f) } -const t = topic("Example"); - -start( () => { - console.log("Ahora el lĂ­der soy yo"); - - t.observable.subscribe( e => console.log( e ) ) -} ); - -Observable.interval(1000).subscribe( e => { - t.send({ e }) -} ); - export { start } export { topic } diff --git a/src/tabs/leader.ts b/src/tabs/leader.ts index b282a5e..9d83456 100644 --- a/src/tabs/leader.ts +++ b/src/tabs/leader.ts @@ -5,7 +5,7 @@ let l: () => void = null; const tabId: string = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx' .replace(/[xy]/g, function (c) { - let r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8); + const r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8); return v.toString(16); }); diff --git a/src/topics/topic.ts b/src/topics/topic.ts index 2f6bbf9..d1caace 100644 --- a/src/topics/topic.ts +++ b/src/topics/topic.ts @@ -10,11 +10,11 @@ class Topic { } send(message: any) { - let key = `kafkaesque-ui.${this.name}.${Date.now().toString()}`; - let value = JSON.stringify(message); + const key = `kafkaesque-ui.${this.name}.${Date.now().toString()}`; + const value = JSON.stringify(message); localStorage.setItem(key, value); - let event: StorageEvent = new StorageEvent('storage', { + const event: StorageEvent = new StorageEvent('storage', { url: window.location.href, key: key, newValue: value