Input
MMO.inputs · 1 symbol · generated 5 Oct 2026
Input
Input.js:8Input
- Namespace
MMO.inputs
Index
| constructor(node) | ||
| update(e) | Update coords and status | |
| getAlias(type) | Returns the event type alias : 'down' : mousedown, pointerdown, touchstart 'up' : mouseup, pointerup, touchsend 'move': mousemove, touchmove, pointermove 'cancel': touchcancel, pointercancel type: … | |
| on(name, func, opts, globally) | addEventListener for the given alias | |
| off(name, func, globally) | removeEventListener for the given alias | |
| add(name, opts, gesture) | Add a new gesture to the input | |
| has(name) | Tells if manager knows a gesture | |
| get(name) | Get a registered gesture. | |
| remove(name) | Remove a gesture from input | |
| connect() | Connect the manager to the input (called by constructor) | |
| disconnect() | Disconnect the manager (normally it is not called) | |
| enable(allow_move, allow_out) | Add listeners on input | |
| disable(allow_move, allow_out) | Remove listeners on input | |
| handle(e) | Called by every listeners set in activate | |
| trigger(gesture) | Trigger gesture | |
| dispatch() | Dispatch the gesture associated event (called internally) |
Methods16
constructor(node)
Input.js:9| node |
update(e)
Input.js:37Update coords and status
| e | event | Any events received by the dom element that containes user input (click, mousedown, ...) |
getAlias(type)
Input.js:89Returns the event type alias : 'down' : mousedown, pointerdown, touchstart 'up' : mouseup, pointerup, touchsend 'move': mousemove, touchmove, pointermove 'cancel': touchcancel, pointercancel type: else
| type | string | event.type |
| returns | string |
on(name, func, opts, globally)
Input.js:116addEventListener for the given alias
| name | string | event type unified (can be down, up, cancel, move, or any other standard event) |
| func | Function | the function to use |
| opts | Object | the options passed to addEventListener (https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener) |
| globally | boolean | if true, will add listener on the window instead of the element |
| returns | MMO.core.Input | this |
off(name, func, globally)
Input.js:144removeEventListener for the given alias
| name | string | event type unified (can be down, up, cancel, move, or any other standard event) |
| func | Function | the function to use |
| globally | ||
| returns | MMO.core.Input | this |
add(name, opts, gesture)
Input.js:170Add a new gesture to the input
| name | string | the unique event's name of the gesture (it will be use as the event's name in dispatch) |
| opts = {} | Object | options for the gesture |
| gesture = null | string | Function | if string it must be defined in GESTURES, else a class inherited from Gesture |
| returns | MMO.core.Gesture | the gesture instance |
has(name)
Input.js:197Tells if manager knows a gesture
| name | string | the unique event's name |
| returns | boolean |
get(name)
Input.js:207Get a registered gesture.
| name | string | the unique name it was registered under |
| returns | MMO.inputs.Gesture | |
| throws | MMO.Error | when no gesture goes by that name |
remove(name)
Input.js:217Remove a gesture from input
| name | string | the unique name of the gesture |
| returns |
connect()
Input.js:232Connect the manager to the input (called by constructor)
| returns |
disconnect()
Input.js:242Disconnect the manager (normally it is not called)
| returns |
enable(allow_move, allow_out)
Input.js:255Add listeners on input
| allow_move | boolean | if manager capture move event |
| allow_out | boolean | if manager can capture move event outside the element |
| returns |
disable(allow_move, allow_out)
Input.js:272Remove listeners on input
| allow_move | boolean | if manager capture move event |
| allow_out | boolean | if manager can capture move event outside the element |
| returns |
handle(e)
Input.js:287Called by every listeners set in activate
| e | Event | |
| returns |
trigger(gesture)
Input.js:331Trigger gesture
| gesture | ||
| returns |
dispatch()
Input.js:348Dispatch the gesture associated event (called internally)
| returns |