Skip to content

Instantly share code, notes, and snippets.

@ianmjones
Last active April 8, 2016 12:51
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 ianmjones/c60a98c56f57dcf3321c0946b9a9e4fe to your computer and use it in GitHub Desktop.
Save ianmjones/c60a98c56f57dcf3321c0946b9a9e4fe to your computer and use it in GitHub Desktop.
Simple runNow() function for wp-cron-pixie
runNow: function() {
// Only bother to run update if not due before next refresh.
var seconds_due = this.model.get( 'seconds_due' );
if ( seconds_due > CronPixie.timer_period ) {
var timestamp = this.model.get( 'timestamp' ) - seconds_due;
this.model.save(
{ timestamp: timestamp, seconds_due: 0 }
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment