Skip to content

Commit

Permalink
fixed readme
Browse files Browse the repository at this point in the history
  • Loading branch information
tinchoz49 committed Apr 6, 2017
1 parent d916a6d commit ad7c1a0
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,15 @@ function Clock({ emitter, props }) {
}

let interval;
emitter.on('create', () => {
interval = setInterval(() => emitter.emit('clock:update'), 1000);
});
emitter.on('destroy', () => {
clearInterval(interval);
});
const hook = {
create() {
interval = setInterval(() => emitter.emit('clock:update'), 1000);
},
destroy(vnode, removeCallback) {
clearInterval(interval);
removeCallback();
}
};

function displayDigit(digit) {
if (digit < 10) {
Expand All @@ -220,7 +223,8 @@ function Clock({ emitter, props }) {

return {
view,
store
store,
hook
};
}

Expand Down

0 comments on commit ad7c1a0

Please sign in to comment.