Created
June 29, 2015 16:46
-
-
Save tkissing/79bf521bf364ec6fc25c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define(function(require) { | |
var ko = require('knockout'); | |
function observeEvent(pubsub, options) { | |
var o = ko.observable(); | |
Object.keys(options).forEach(function(evt) { | |
var value = options[evt]; | |
pubsub.on(evt, function() { | |
o(value); | |
}); | |
}); | |
// return read-only version to discourage bad coding patterns | |
return ko.computed(function() { | |
return o(); | |
}); | |
} | |
return observeEvent; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define(function(require) { | |
var ko = require('knockout'); | |
var pubsub = require('pubsub'); | |
var observe = require('pubsub-observable'); | |
function Model() { | |
this.isAirRecording = observe(pubsub, {'airrecording:started': true, 'airrecording:stopped': false}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment