Show:

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:

  • inputs Object | String[]

    Dictionary with {identifier : option} pairs or an array of identifier strings

  • [options] Object optional

    Options for all inputs

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.String

    an array of registered input keys or an object with fields {input key : input options}

filter

(
  • filterFn
)

Inherited from Streams.SimpleStream:

Filter converts the current stream into a new stream that only emits if the filter condition is satisfied. The function should return a Boolean.

Parameters:

  • filterFn Function
    Function to filter event payload

getInput

(
  • key
)
Input

Get a registered input by key

Parameters:

  • key String

    Identifier for input class

Returns:

Input:

map

(
  • mapperFn
)

Inherited from Streams.SimpleStream:

Map converts the current stream into a new stream with a modified (mapped) data payload.

Parameters:

  • mapperFn Function
    Function to map event payload

pluck

(
  • key
)

Inherited from Streams.SimpleStream:

Pluck is an opinionated mapper. It projects a Stream onto one of its return values. Useful if a Stream returns an array or an object.

Parameters:

register

(
  • inputObject
)
static

Register a global input class with an identifying key

Parameters:

  • inputObject Object

    an object of {input key : input options} fields

setOptions

(
  • options
)

Helper to set options on all input instances

Parameters:

  • options Object

    options object

split

(
  • splitterFn
)

Inherited from Streams.SimpleStream:

Split maps one of several streams based on custom logic. The function should return an EventEmitter.

Parameters:

subscribeInput

(
  • key
)

Subscribe events from an input class

Parameters:

  • key String

    identifier for input class

unsubscribeInput

(
  • key
)

Unsubscribe events from an input class

Parameters:

  • key String

    identifier for input class

Properties

DIRECTION

Object static

Constrain the input along a specific axis.

Sub-properties: