Skip to main content

enode.when()

enode.when() is used to register an action handler to the current enode.

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

Syntax

JavaScript
enode.when(actionName: String, actionHandler: Function)

Parameters

actionName

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

actionHandler

  • The action handler function to be invoked when get called.

Return value

The current enode, ready for the chaining method calls.

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);
});