Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[dash-dev] added new functions to JS global....

Monkeys,


I'm making another checkin this morning. It shows how to extend the _javascript_ global object to place some common JS functions onto global, for example, alert(), prompt(), etc. I've also added console logging to JS, both 'out' and 'err'. Here's a list of what I am adding:

"alert" - alert dialog
"confirm" - shows text with OK and Cancel
"prompt" - displays text with an input field

"execute" - allows the execution of arbitrary apps
"getProperty" - get system properties
"parseXML" - parse an xml string and return a Document object
"runOnUIThread" - runs a function on the UI thread

"setTimeout" - see sample
"clearTimeout" - clears the timeout set by setTimeout

out - console out
err - Java error console

Here's an example of setTimeout():

/*
 * Menu: Timeout Test
 * Kudos: Paul Colton
 * License: EPL 1.0
 */

 

function main()
{
setTimeout(tester, 2000);
}

function tester()
{
alert("Time!");
}



Paul Colton
aptana.com | aptana.tv




Back to the top