Skip to content

Instantly share code, notes, and snippets.

@jesmin-n
Created April 22, 2015 05:38
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 jesmin-n/cc369469e6552fff7002 to your computer and use it in GitHub Desktop.
Save jesmin-n/cc369469e6552fff7002 to your computer and use it in GitHub Desktop.
Handler.bind("/time", Object.create(Behavior.prototype, {
onInvoke: { value:
function(handler, message) {
application.distribute( "onTimeUpdated" );
handler.invoke( new Message( "/delay?duration=60000" ) ); //will check time again after 1 minute
},
},
}));
Handler.bind("/delay", Object.create(Behavior.prototype, {
onInvoke: { value:
function(handler, message) {
var query = parseQuery( message.query );
var duration = query.duration;
handler.wait( duration )
},
},
onComplete: { value:
function(handler, message) {
handler.invoke( new Message( "/time" ) );
},
},
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment