Inputs.GenericInput Class
samsara/inputs/GenericInput.js:18
Combines multiple inputs (e.g., mouse, touch, scroll) into one unified input. Inputs must first be registered on the constructor by a unique identifier, then they can be accessed on instantiation.
Constructor
Inputs.GenericInput
-
inputs
-
[options]
Parameters:
Example:
// In main.js
GenericInput.register({
"mouse" : MouseInput,
"touch" : TouchInput
});
// in myFile.js
var input = new GenericInput(['mouse', 'touch'], options);
Methods
addInput
-
inputs
Add an input class to from the registered classes
Parameters:
-
inputs
Object | Array.Stringan array of registered input keys or an object with fields {input key : input options}
filter
-
filterFn
Parameters:
-
filterFn
FunctionFunction to filter event payload
getInput
-
key
Get a registered input by key
Parameters:
-
key
StringIdentifier for input class
Returns:
map
-
mapperFn
Parameters:
-
mapperFn
FunctionFunction to map event payload
pluck
-
key
register
-
inputObject
Register a global input class with an identifying key
Parameters:
-
inputObject
Objectan object of {input key : input options} fields
setOptions
-
options
Helper to set options on all input instances
Parameters:
-
options
Objectoptions object
split
-
splitterFn
Parameters:
-
splitterFn
FunctionSplitter function
subscribeInput
-
key
Subscribe events from an input class
Parameters:
-
key
Stringidentifier for input class
unsubscribeInput
-
key
Unsubscribe events from an input class
Parameters:
-
key
Stringidentifier for input class