Labs/Jetpack/Reboot/JEP/108: Difference between revisions

Line 25: Line 25:
=== API Methods ===
=== API Methods ===


* $Moz.background({ interval: 10000, bind:jetpack.tabs[0] }, function(){ return window.document; });   
* $Moz.background({ interval: 10000, bind:jetpack.tabs[0] }, function(){
      return window.document;
  });   


** Background Page work units are bound with the Background Page's window object by default
** Background Page work units are bound with the Background Page's window object by default
** If interval option is present, the function is wrapped with setInterval(); and the $Moz.background method returns the interval timer so that it may be cleared outside of the Background Page.
** If interval option is present, the function is wrapped with setInterval(); and the $Moz.background method returns the interval timer so that it may be cleared outside of the Background Page.
** Functional context for the function passed to the background page can be passed as an option
** Functional context for the function passed to the background page can be passed as an option
1,273

edits