Casio Naurtech CETerm Ver.5.5 Scripting Guide Bedienungsanleitung Seite 119

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 164
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 118
NAURTECH WEB BROWSER AND TERMINAL EMULATION FOR WINDOWS CE AND WINDOWS MOBILE
CETerm Scripting Guide Page 119
JavaScript uses “garbage collection” to reclaim memory no longer in use.
Memory occupied by global variables may never be reclaimed, whereas local
variable memory can be reclaimed after a function call completes. Because the
JavaScript engine in CETerm is not reset frequently like a browser JavaScript
engine, it is more likely that poor programming practices could exhaust memory.
5.9.2 Encapsulate Code in Functions
Whenever possible, put multiple script actions within a function. This should
minimize compilations and make it easier to use local variables as described
above. For example, the following actions could be in a script which is bound to
a key-combination:
CETerm.SetProperty( "session1.scanner.upca.enabled", true );
CETerm.SetProperty( "session1.scanner.msi.enabled", false );
CETerm.SetProperty( "session1.scanner.pdf417.enabled", false );
CETerm.PlayTone( 8, 2000, 200 );
CETerm.PlayTone( 8, 1500, 200 );
CETerm.PostIDA( "IDA_SCAN_APPLYCONFIG", 0 );
Or, the actions could be in a function which is loaded with “Load at Startup
function enableUPCA()
{
CETerm.SetProperty( "session1.scanner.upca.enabled", true );
CETerm.SetProperty( "session1.scanner.msi.enabled", false );
CETerm.SetProperty( "session1.scanner.pdf417.enabled", false );
CETerm.PlayTone( 8, 2000, 200 );
CETerm.PlayTone( 8, 1500, 200 );
CETerm.PostIDA( "IDA_SCAN_APPLYCONFIG", 0 );
{
and the function call, in a separate script, could be bound to the key-
combination:
enableUPCA();
Using the later approach, the function is only compiled once, not each time the
key is pressed. In general, separating the function definitions from the invocation
is a good practice.
Seitenansicht 118
1 2 ... 114 115 116 117 118 119 120 121 122 123 124 ... 163 164

Kommentare zu diesen Handbüchern

Keine Kommentare