Skip to content

Latest commit

 

History

History
108 lines (77 loc) · 3.65 KB

File metadata and controls

108 lines (77 loc) · 3.65 KB

Manager

Class that tracks user input for a given DOM element and outputs an object of type Input to the InputObservable, that can be acquired through the function InputManager.getInputObservable();

The input manager will automatically attach itself to the 'document' and listen for any and all key presses, but one may set it to listen for key presses on a specific DOM element.

Kind: global class

new Manager(DOMElement, bindings)

Attaches InputManager to a given DOMElement, or if none is passed, attaches it to entire document.

Param Type Description
DOMElement Node the desired element
bindings Object map of key values to an array of actions etc)

manager.toggleEmissions()

Toggles whether inputs are emitted;

Kind: instance method of Manager

manager.startSession()

Starts session and timer. Turns on both emissions and recording, if not already on. Assumes song timer is at zero.

Kind: instance method of Manager

manager.terminateSession() ⇒ Array.<ActionEvent>

Terminates session and returns array of action events recorded.

Kind: instance method of Manager
Returns: Array.<ActionEvent> - all action events recorded.

manager.pauseSession()

Pauses recording and timer, if session is ongoing.

Kind: instance method of Manager

manager.resumeSession()

Resumes recording and timer, if session is ongoing.

Kind: instance method of Manager

manager.getObservable()

Returns the action observable. Subscribe to this observable to handle actions.

Kind: instance method of Manager

manager.clear()

Clears subscriptions to clear memory.

Kind: instance method of Manager

manager.bindAction(key, action)

Deprecated

Kind: instance method of Manager

Param Type Description
key String the value of a key as defined in https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values
action String to be bound to key

manager.setBinding(key, action)

Binds an array of actions to a given key. WARNING: this will erase all previous bindings.

Kind: instance method of Manager

Param Type Description
key String the value of a key as defined in https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values
action String an array of actions to be bound