Tools for EventScripter

System function: local()

Description

local(string key [, object value]) : object

Gets or sets a local session variable for current running script. It's a short combined version of getProperty(key, false) and setProperty(key, value, false).

Example

// Trigger Required: "Interval"
// Options recommended: 1000ms, synchronous

require(JD_HOME + "/eventscripter/system/local.js");

var counter = local("counter") || 0;
counter += 1;
alert(counter);
local("counter", counter);

Sourcecode

JD_HOME/eventscripter/system/local.js
/*jslint browser */
/*global getProperty, setProperty */
function local(k, v) {
    "use strict";

    return (
        (v === undefined)
        ? (getProperty(k, false) || null)
        : setProperty(k, v, false)
    );
}