Scripting Guide

NAURTECH WEB BROWSER AND TERMINAL EMULATION FOR WINDOWS CE AND WINDOWS MOBILE
CETerm Scripting Guide Page 118
default:
if (responseState === "DATA")
{
// Save character
responseData.push( String.fromCharCode( c ) );
}
break;
}
}
if (responseState === "DONE")
{
// Process message
// Maybe schedule another data detection after processed.
MyProcessMessage( responseData );
responseState = "PRE_STX";
}
else
{ // Schedule another data detection to complete message
sp.WaitForEvent();
}
}
5.9 WRITING EFFICIENT SCRIPTS
Good programming practices should be used when developing scripts for
CETerm. In general, it is important to conserve memory, minimize script
compilations, and limit execution times. Please refer to a JavaScript
programming book for more information. We recommend “JavaScript: The
Definitive Guide (5th Edition) by David Flanagan. The following URL is an
excellent starting point for in-depth details about JavaScript and good
programming practices: http://javascript.crockford.com/.
5.9.1 Use Local Variables
Whenever possible, use local variables within functions and declare them with
the var keyword, like this:
var status;
var message = "hello";
var i, j, k;
If you fail to use the var keyword, then JavaScript automatically creates a global
variable with that name if it has not already been declared outside a function.