Sherzy
3/17/2016 - 5:04 PM

typeof Function exists - call it

typeof Function exists - call it

// ex. use json to create array of "buttons" 
Tech.tools = [
    {
        "text": "Enter CastNet ID",
        "action": "enterCastNETId"
    }
];

// then call the function if existing
var descriptor = Tech.currentTool.action;
if (typeof Tech[descriptor] === "function") {
    Tech[descriptor](cmd);
}

// or a known function (overload)
if (typeof this.processData == "function")
    data = this.processData(data);