JavaScript API: Basic Functions

From DevWiki

Jump to: navigation, search

Back to API Reference


Contents


basic functions

Anything you do can do in Javascipt you can do in boxee. The only difference is anytime you want to perform an action that interacts with the player or page it must be run through the browser.execute() function. The following basic functions are always available when writing control scripts and used very often by boxee developers.


alert

alert(string)
Alert works a bit differently in boxee then in a normal browser. No alert dialog will be displayed. Howver the alert() function now acts as a print function, printing to the javascript debug log.
alert("this is an alert that will be written to the debug log");


setTimeout

setTimeout(statement jscode, int milliseconds)
Executes a code some time in the future
setTimeout("alert('5 seconds!')",5000);


cancelTimeout

cancelTimeout(var variable)
cancels the setTimeout()
var t = setTimeout("alert('5 seconds!')",5000);
clearTimeout(t);


setInterval

setInterval(statement jscode, int milliseconds)
Similar to setTimeout, but keeps triggering expression again and again until stopped
var t = setInterval("alert('you'll see this again in 5 seconds!')",5000);


cancelInterval

cancelInterval(var variable)
Stop an interval from executing
var t = setInterval("alert('you'll see this again in 5 seconds!')",5000);
cancelInterval(t);
Personal tools