Index

Input

MMO.inputs · 1 symbol · generated 5 Oct 2026

class

Input

Input.js:8

Input

class MMO.inputs.Input
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

update(e)

Input.js:37

Update coords and status

update(e)
eeventAny events received by the dom element that containes user input (click, mousedown, ...)

getAlias(type)

Input.js:89

Returns the event type alias : 'down' : mousedown, pointerdown, touchstart 'up' : mouseup, pointerup, touchsend 'move': mousemove, touchmove, pointermove 'cancel': touchcancel, pointercancel type: else

getAlias(type)
typestringevent.type
returnsstring

on(name, func, opts, globally)

Input.js:116

addEventListener for the given alias

on(name, func, opts, globally)
namestringevent type unified (can be down, up, cancel, move, or any other standard event)
funcFunctionthe function to use
optsObjectthe options passed to addEventListener (https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener)
globallybooleanif true, will add listener on the window instead of the element
returnsMMO.core.Inputthis

off(name, func, globally)

Input.js:144

removeEventListener for the given alias

off(name, func, globally)
namestringevent type unified (can be down, up, cancel, move, or any other standard event)
funcFunctionthe function to use
globally
returnsMMO.core.Inputthis

add(name, opts, gesture)

Input.js:170

Add a new gesture to the input

add(name, opts = {}, gesture = null)
namestringthe unique event's name of the gesture (it will be use as the event's name in dispatch)
opts = {}Objectoptions for the gesture
gesture = nullstring | Functionif string it must be defined in GESTURES, else a class inherited from Gesture
returnsMMO.core.Gesturethe gesture instance

has(name)

Input.js:197

Tells if manager knows a gesture

has(name)
namestringthe unique event's name
returnsboolean

get(name)

Input.js:207

Get a registered gesture.

get(name)
namestringthe unique name it was registered under
returnsMMO.inputs.Gesture
throwsMMO.Errorwhen no gesture goes by that name

remove(name)

Input.js:217

Remove a gesture from input

remove(name)
namestringthe unique name of the gesture
returns

connect()

Input.js:232

Connect the manager to the input (called by constructor)

connect()
returns

disconnect()

Input.js:242

Disconnect the manager (normally it is not called)

disconnect()
returns

enable(allow_move, allow_out)

Input.js:255

Add listeners on input

enable(allow_move, allow_out)
allow_movebooleanif manager capture move event
allow_outbooleanif manager can capture move event outside the element
returns

disable(allow_move, allow_out)

Input.js:272

Remove listeners on input

disable(allow_move, allow_out)
allow_movebooleanif manager capture move event
allow_outbooleanif manager can capture move event outside the element
returns

handle(e)

Input.js:287

Called by every listeners set in activate

handle(e)
eEvent
returns

trigger(gesture)

Input.js:331

Trigger gesture

trigger(gesture)
gesture
returns

dispatch()

Input.js:348

Dispatch the gesture associated event (called internally)

dispatch()
returns