App.Wel.registerCustomCondition(
function(element,condition,action,elseAction,delay,ifCond) {
//Check to see if the condition passed should be handled by this function
if (condition === "myCondition") {
//Evaluate condition and determine whether or not it is met
var conditionMet = true;
//Create a function to be executed if the condition is net and the expression's
//if clause evaluates to true
var actionFunc = App.Wel.makeConditionalAction(id,action,ifCond);
//Create a function to call if the condition evaluates to false, and an else action was speified
var elseActionFunc = elseAction ? App.Wel.makeConditionalAction(id,elseAction,null) : null;
//Execute one action or the other, taking delay into account
if (conditionMet) {
App.Wel.executeAfter(actionFunc,delay);
}
else {
App.Wel.executeAfter(actionFunc,delay);
}
}
}
);
==== Creating custom actions ====
An action is any kind of behavior that happens when some condition is satisfied. You can create custom actions through our JavaScript API as well. The following example will alert any text passed to it:
App.Wel.registerCustomAction('a', {
execute: function(id,action,params) {
// get text name
var arg1= params[0].key.split(",");
var text = arg1[0];
alert(text);
}
});
The ''a'' action can now be accessed in Expressions using the following syntax:
Click me to alert 'Booyah!'