Skip to content

Instantly share code, notes, and snippets.

@emarthinsen
Created February 1, 2016 22:28
Show Gist options
  • Save emarthinsen/3f3567a6a05fd2f578ba to your computer and use it in GitHub Desktop.
Save emarthinsen/3f3567a6a05fd2f578ba to your computer and use it in GitHub Desktop.
Long-lived Plugin
var interval = null;
var onStart = function(context) {
[coscript setShouldKeepAround:true];
interval = [coscript scheduleWithInterval:1.0 jsFunction:function() {
log("In interval");
}];
};
var onStop = function(context) {
if(interval) {
[interval cancel];
log("Interval canceled");
} else {
log("No interval to cancel");
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment