Skip to content
This repository has been archived by the owner on Dec 19, 2017. It is now read-only.

Commit

Permalink
Properly dispose subscriptions in example (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
caseyWebb authored Sep 29, 2016
1 parent c2c4753 commit 995816f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 20 deletions.
2 changes: 1 addition & 1 deletion example/dist/bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion example/dist/bundle.js.map

Large diffs are not rendered by default.

8 changes: 2 additions & 6 deletions example/views/bindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,8 @@ ko.components.register('bindings', {
synchronous: true,
viewModel: class Bindings {
constructor(ctx) {
this.sub = ctx.hash.subscribe((h) => {
$(`#${h}`).velocity('scroll')
})
}
dispose() {
this.sub.dispose()
const sub = ctx.hash.subscribe((h) => $(`#${h}`).velocity('scroll'))
ctx.addBeforeNavigateCallback(() => sub.dispose())
}
},
template: `
Expand Down
8 changes: 2 additions & 6 deletions example/views/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,8 @@ ko.components.register('config', {
synchronous: true,
viewModel: class Config {
constructor(ctx) {
this.sub = ctx.hash.subscribe((h) => {
$(`#${h}`).velocity('scroll')
})
}
dispose() {
this.sub.dispose()
const sub = ctx.hash.subscribe((h) => $(`#${h}`).velocity('scroll'))
ctx.addBeforeNavigateCallback(() => sub.dispose())
}
},
template: `
Expand Down
8 changes: 2 additions & 6 deletions example/views/ctx.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@ ko.components.register('context', {
synchronous: true,
viewModel: class Context {
constructor(ctx) {
this.sub = ctx.hash.subscribe((h) => {
$(`#${h}`).velocity('scroll')
})
}
dispose() {
this.sub.dispose()
const sub = ctx.hash.subscribe((h) => $(`#${h}`).velocity('scroll'))
ctx.addBeforeNavigateCallback(() => sub.dispose())
}
},
template: `
Expand Down

0 comments on commit 995816f

Please sign in to comment.