Skip to main content

enode.action()

enode.action() is used to retrieve an action handler of the current enode.

This method is pair-working with enode.when() to simulate an action for UI components.

Syntax

JavaScript
enode.action(actionName: String)

Parameters

actionName

  • A case-sensitive string which specifies the name of action.

Return value

A function to invoke the registered action handler to process custom inputs as parameters.

Examples

JavaScript
var textInput = new Binh.ElementNode(document.createElement('input'));

textInput.on('change', function(event) {
var handleValueChanged = textInput.action('change-value');
handleValueChanged(event.value);
});

textInput.when('change-value', function(value) {
// hanle action
alert(value);
});