Module: Events

Events

Source:

Methods

<inner> add(obj, event, handler, opt_useCapture)

Registers an event listener to fire the given callback when a specified event is triggered on the given object.
Parameters:
Name Type Argument Description
obj Element | Document | Window Object which supports events. This includes DOM elements, the Document itself, and the Window object for example.
event string Name of the event for which to register the given callback.
handler function Function to be invoked when event is triggered on the given object.
opt_useCapture boolean <optional>
Optional. Whether to add the handler in the capturing phase.
Source:

<inner> isWithCtrl(event) → {boolean}

Given an event object, checks whether the ctrl key is depressed.
Parameters:
Name Type Description
event Object
Source:
Returns:
Type
boolean

<inner> isWithShift(event) → {boolean}

Given an event object, checks whether the shift key is depressed.
Parameters:
Name Type Description
event Object
Source:
Returns:
Type
boolean

<inner> nextTick(fn)

Runs the given function after the current event handler returns to the browser. Currently implemented just with setTimeout() which is specced to have a minimum timeout value of 4 milliseconds. Alternate implementations are possible that are faster, for example: https://github.com/NobleJS/setImmediate
Parameters:
Name Type Description
fn function a function to call
Source:

<inner> preventDefault(event)

Flags the given event to prevent native handlers from performing default behavior for it.
Parameters:
Name Type Description
event Event
Source:

<inner> remove(obj, event, handler, opt_useCapture)

Detaches the specified event callback from the given event.
Parameters:
Name Type Argument Description
obj Element | Document | Window Object which supports events. This includes DOM elements, the Document itself, and the Window object for example.
event string Name of the event to detach.
handler function Function to be de-registered.
opt_useCapture boolean <optional>
Optional. Must be true if the handler was registered with a true useCapture argument.
Source:

<inner> setup(editor, document)

Sets up all editing browser events to call `editor` on the given document.
Parameters:
Name Type Description
editor function
document Element
Source:

<inner> stopPropagation(event)

Stops this event from bubbling any further up the DOM tree.
Parameters:
Name Type Description
event Event
Source:

<inner> suppress(event)

"Suppresses" the given event such that it will not trigger default behavior and nor propagate. This will prevent any parent handlers up of the DOM tree from being notified of this event.
Parameters:
Name Type Description
event Event
Source: