Created
May 18, 2015 17:56
-
-
Save odoe/d7ce67f7ebd06f949dbb 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([ | |
'intents/Intent', | |
'rx/rx' | |
], function( | |
Intent, Rx | |
) { | |
if (!_instance) { | |
var _instance = new Rx.Subject(); | |
} | |
var state = { | |
x: 0, | |
y: 0 | |
}; | |
function update(data) { | |
state = data; | |
_instance.onNext(state); | |
} | |
Intent.subject.subscribe(function(data) { | |
update(data); | |
}); | |
_instance.onNext(state); | |
return _instance; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment