Class: ActionWidget

ActionWidget

new ActionWidget(args, name, fire, values, description, blockers)

Base class for widgets that create Action objects

Children are encouraged to extend the 'value' object. The 'values' element is just sugar for managing values that can be passed as a raw string or a variable name that may or may not exist.
Name Type Description
args Object widget arguments
name string name of child object (passed in from child constructor)
fire function fire the associated action (passed in from child constructor)
values Array list of values to manage specially
description function describe the associated action (passed in from child constructor)
blockers function list of things that are blocking the action from firing
Example
var widget = new ChildOfActionWidget({

    // default values (can be changed with val()):
    namespace      : 'variables namespace', // namespace to retrieve variables from
    keys           : {...}, // keys to use when resolving variables

    // other data needed for the widget to function:
    v           : variables, // Variables object
    thread_id   : 12345, // variables will be parsed as if rendered in this thread
    callback    : function(keys) { ... }, // called with the current data
    container   : widget_appended_to_this

});

Extends

Methods

Action built by this selector

Returns:
Type Description
Action

reset_value(current_value, name){string}

Update the "reset" data and get a stored value

this should be called by a "reset" button, to reset the contents of an input to a recent value
Name Type Description
current_value string current value as entered by the user (which we can reset to)
name string variable name
Returns:
Type Description
string new value

resolve_value(name, name_suffix, keys, parser, value)

Resolve one of the values defined in the constructor

Name Type Description
name string variable name
name_suffix string array appended to variable name during resolution
keys Object optional keys to use when resolving
parser string optional how to parse the variable
value string | null (if defined) or null (otherwise)

set_value(current_value, name, name_suffix, keys, parser, new)

Update the "reset" data and get a new value (if changed)

Name Type Description
current_value string current value as entered by the user (which we can reset to)
name string variable name
name_suffix string array appended to variable name during resolution
keys Object optional keys to use when resolving
parser string optional how to parse the variable
new string optional value (if defined and in need of an update)

update_previous_values()

Specify new values for reset_value()

records values from this.val(), will return them on reset

Get/set widget's values

Name Type Description
value Object new value
Returns:
Type Description
Object (new) value