controllerActions

actions() actions.messages = [remove_element, pause, unpause, <accepts any message>] actions.events = [click, dblclick, select, change, submit, reset, mouseover, mouseout, mousedown, mouseup, mousemove, keydown, keypress, keyup, dragstart, drag, dragenter, dragleave, dragover, dragend, drop, load, unload, abort, error, resize, scroll, focus, blur, focusin, focusout, <these DOM events but suffixed with>_capture, <fires every received message as event>]

Description

Performs DOM operations on the element (e.g. remove_element from DOM) and actions related to all element's controllers (e.g. pause all controllers).

Adds DOM event listeners to the element and fires behave3d events upon receiving DOM events.

Fires an event upon receiving any message, so controllers listening for particular events can perform actions without being called directly. This allows code to order actions on an element without the need to know which controller(s) are going to execute them.

Every behave3d element upon its creation is automatically assigned an actions() controller with id = "a". An element cannot have other actions() controllers, and attempting to add ones will modify the controller with id = "a".

For example,
Behave3d(element).add("actions(remove_element on: 200 after click)")
is the same as
Behave3d([element, "a"]).set({"remove_element on": "200 after click"})

Note: The actions controller adds DOM event listeners only when needed. A new listener is added when the controller itself is attached for the first time a behave3d-event listener for event with the same name.

Parameters

Controller actions() doesn't have any parameters.

Accepted Messages

Messages accepted by actions():

remove
Removes this HTML element (together with its Behave3d.Element and controllers) from the DOM tree and the behave3d's pool of elements. Message params: none
pause
Pauses all of the element's controllers. Message params: none
unpause
Un-pauses all of the element's controllers. Message params: none

Generated Events

Visit page Controller # Common Events for documentation on the events, generated by all controllers: frame, remove, paused, unpaused enabled and disabled.

Events fired by actions():

click, dblclick, select, change, submit, reset, mouseover, mouseout, mousedown, mouseup, mousemove, keydown, keypress, keyup, dragstart, drag, dragenter, dragleave, dragover, dragend, drop, load, unload, abort, error, resize, scroll, focus, blur, focusin, focusout
Fired upon the element receiving DOM events. The original DOM event is supplied in the event parameter event. Event params: {event: <DOM event>}
click_capture, ... focusout_capture
Fired upon the element receiving DOM events from listeners added with useCapture. The original DOM event is supplied in the event parameter event. Event params: {event: <DOM event>}
remove_element, pause, unpause, and <any name of a message sent to the controller>
The actions() controller fires every received message as an event, with the name and parameters of the event being copied from the name and params of the message. Event params: {same as message params}

Interaction with DOM

Changes Log

  1. Controller introduced in v.0.80.
  2. Listening for all standard DOM events added in v.0.81.

Examples

Coming soon...

See Also