Keyboard

Keyboard

Class for Keyboard objects.

Note: input device objects are only ever used in Actions

Constructor

new Keyboard(id)

Each device is associated a unique ID like keyboard1, keyboard2.

Parameters:
Name Type Description
id string

The unique ID of the device

Source:
Example
var keyboard = new Actions.Keyboard('keyboard')
var actions = new Actions(keyboard)

Extends

Methods

Up(key)

Unpress the specified key on the keyboard

This method will be added to the action's tick property. prefixed with the Keyboard's ID.

Parameters:
Name Type Description
key string

The key to unpress. You can use special keys defined in Actions#Keys

Source:
Example
var actions = new Actions( new Pointer('bigKeyboard'))

    actions.tick.bigKeyboardDown('a').
            tick.bigKeyboardUp('a')

    actions.tick.bigKeyboardDown(Actions.Keys.ENTER)
           .tick.bigKeyboardUp(Actions.Keys.ENTER)

Down(key)

Press the specified key on the keyboard

This method will be added to the action's tick property. prefixed with the Keyboard's ID.

Parameters:
Name Type Description
key string

The key to press. You can use special keys defined in Actions#Keys

Source:
Example
var actions = new Actions( new Pointer('bigKeyboard'))

    actions.tick.bigKeyboardDown('a').
            tick.bigKeyboardUp('a')

    actions.tick.bigKeyboardDown(Actions.Keys.ENTER)
           .tick.bigKeyboardUp(Actions.Keys.ENTER)

Pause(duration)

Pause the keyboard for the specified length of time

This method will be added to the action's tick property. prefixed with the Keyboard's ID.

Parameters:
Name Type Default Description
duration number 0

Duration of the pause

Source:
Example
var bigMouse = new Actions.Pointer('bigMouse')
   var bigKeyboard = new Actions.Keyboard('bigKeyboard')

   var actions = new Actions(bigMouse, bigKeyboard)
   actions.tick.bigKeyboardPause().bigMouseMove({ x: 100, y: 200, duration: 4000 })
   actions.performActions(actions)