Skip to content

Instantly share code, notes, and snippets.

@odoe
Created May 18, 2015 17:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save odoe/d7ce67f7ebd06f949dbb to your computer and use it in GitHub Desktop.
Save odoe/d7ce67f7ebd06f949dbb to your computer and use it in GitHub Desktop.
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