git ssb

1+

Matt McKegg / mutant



Commit b645b2baf1b153c97d7f9d13ee6b47556d710d1c

computed, map: onListen will now run a function if returned when unlistening

Matt McKegg committed on 9/20/2016, 6:52:46 AM
Parent: bd426f70b20582a00fe0bfa9e1fca8d3d28f0acc

Files changed

computed.jschanged
map.jschanged
computed.jsView
@@ -83,9 +83,12 @@
8383 this.live = true
8484 this.lazy = true
8585
8686 if (this.opts && this.opts.onListen) {
87- this.opts.onListen()
87+ var release = this.opts.onListen()
88+ if (typeof release === 'function') {
89+ this.releases.push(release)
90+ }
8891 }
8992 }
9093 },
9194 unlisten: function () {
map.jsView
@@ -56,9 +56,12 @@
5656 })
5757 })
5858
5959 if (opts && opts.onListen) {
60- opts.onListen()
60+ var release = opts.onListen()
61+ if (typeof release === 'function') {
62+ releases.push(release)
63+ }
6164 }
6265 }
6366
6467 function unlisten () {

Built with git-ssb-web