on

Description

Register a listener for an event on the window. The listener is called with the event's payload each time the event fires. Register the same listener with multiple events, or multiple listeners for one event, as needed.

binaryWindow.on(eventName, listener);

Parameters

NameTypeDescription
eventNamestringName of the event to listen for. e.g., 'pane-add'.
listenerfunctionCalled with the event payload when the event fires.

The before-pane-add and before-pane-remove events are vetoable: a listener that returns false cancels the action. Return values from other events are ignored. See Events for the full list of events and their payloads.

Returns

Type: void

Examples

function handleAdd(sash) {
  console.log('pane added', sash.id);
}

binaryWindow.on('pane-add', handleAdd);

See also