Class: Keyboard

Keyboard


new Keyboard()

Source:

Members


keys :object

List of available keys.

Type:
  • object
Source:

Methods


addListener()

Inherited From:
Source:

down(key)

Check if key is pressed down.

Parameters:
Name Type Description
key string

Name of the key to check

Source:
Returns:

Whether this key is pressed down

Type
Boolean

emit(event, a1, a2, a3, a4, a5)

Emit an event to all registered event listeners.

Parameters:
Name Type Description
event string

The name of the event.

a1 *

First param

a2 *

Second param

a3 *

Third param

a4 *

Forth param

a5 *

Fifth param

Inherited From:
Source:
Returns:

Indication if we've emitted an event.

Type
boolean

listeners(event, exists)

Return a list of assigned event listeners.

Parameters:
Name Type Description
event string

The events that should be listed.

exists boolean

We only need to know if there are listeners.

Inherited From:
Source:
Returns:

Listener list

Type
array | boolean

off()

Inherited From:
Source:

on(event, fn, context)

Register a new EventListener for the given event.

Parameters:
Name Type Description
event string

Name of the event.

fn functon

Callback function.

context Mixed

The context of the function.

Inherited From:
Source:
Returns:

Self for chaining

Type
EventEmitter

once(event, fn, context)

Add an EventListener that's only called once.

Parameters:
Name Type Description
event string

Name of the event.

fn function

Callback function.

context Mixed

The context of the function.

Inherited From:
Source:
Returns:

Self for chaining

Type
EventEmitter

removeAllListeners(event)

Remove all listeners or only the listeners for the specified event.

Parameters:
Name Type Description
event string

The event want to remove all listeners for.

Inherited From:
Source:
Returns:

Self for chaining

Type
EventEmitter

removeListener(event, fn, context, once)

Remove event listeners.

Parameters:
Name Type Description
event string

The event we want to remove.

fn function

The listener that we need to find.

context Mixed

Only remove listeners matching this context.

once boolean

Only remove once listeners.

Inherited From:
Source:
Returns:

Self for chaining

Type
EventEmitter

Class: Keyboard

Keyboard


new Keyboard()

Source:
Fires:
  • event:keydown
  • event:keyup

Extends

Members


keys :object

List of available keys.

Type:
  • object
Source:

Methods


addListener()

Inherited From:
Source:

down(key)

Check if key is pressed down.

Parameters:
Name Type Description
key string

Name of the key to check

Source:
Returns:

Whether this key is pressed down

Type
Boolean

emit(event, a1, a2, a3, a4, a5)

Emit an event to all registered event listeners.

Parameters:
Name Type Description
event string

The name of the event.

a1 *

First param

a2 *

Second param

a3 *

Third param

a4 *

Forth param

a5 *

Fifth param

Inherited From:
Source:
Returns:

Indication if we've emitted an event.

Type
boolean

listeners(event, exists)

Return a list of assigned event listeners.

Parameters:
Name Type Description
event string

The events that should be listed.

exists boolean

We only need to know if there are listeners.

Inherited From:
Source:
Returns:

Listener list

Type
array | boolean

off()

Inherited From:
Source:

on(event, fn, context)

Register a new EventListener for the given event.

Parameters:
Name Type Description
event string

Name of the event.

fn functon

Callback function.

context Mixed

The context of the function.

Inherited From:
Source:
Returns:

Self for chaining

Type
EventEmitter

once(event, fn, context)

Add an EventListener that's only called once.

Parameters:
Name Type Description
event string

Name of the event.

fn function

Callback function.

context Mixed

The context of the function.

Inherited From:
Source:
Returns:

Self for chaining

Type
EventEmitter

removeAllListeners(event)

Remove all listeners or only the listeners for the specified event.

Parameters:
Name Type Description
event string

The event want to remove all listeners for.

Inherited From:
Source:
Returns:

Self for chaining

Type
EventEmitter

removeListener(event, fn, context, once)

Remove event listeners.

Parameters:
Name Type Description
event string

The event we want to remove.

fn function

The listener that we need to find.

context Mixed

Only remove listeners matching this context.

once boolean

Only remove once listeners.

Inherited From:
Source:
Returns:

Self for chaining

Type
EventEmitter