Skip to content

Commit

Permalink
Change let to const. Remove test code from index.ts.
Browse files Browse the repository at this point in the history
  • Loading branch information
jhovanyamaya committed Feb 24, 2017
1 parent 47d3813 commit 40a2756
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 17 deletions.
13 changes: 0 additions & 13 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -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 }
2 changes: 1 addition & 1 deletion src/tabs/leader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

Expand Down
6 changes: 3 additions & 3 deletions src/topics/topic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 40a2756

Please sign in to comment.