Class: HotkeyClient

Hotkey Client

This module contains the Hotkey Client, used for registering hotkey combinations and their respective handler functions with Finsemble.

The client can handle two types of hotkeys: local hotkeys, for which the handlers will only fire when the window which defined the hotkey is in focus, and global hotkeys, which will fire regardless of what window is in focus.

For more information, see the Hotkey tutorial.

new HotkeyClient
(params)
clients/hotkeysClient.js, line 176

Name Type Description
params *

Methods

addGlobalHotkey
(keyArr, handler, cb)
clients/hotkeysClient.js, line 274

Adds a global hotkey, firing regardless of what window is in focus. If you execute this function more than once for the same key combination, both hotkeys will coexist, and would need to be remove separately.

Name Type Description
keyArr Array.<string>

Array of strings representing hotkey key combination. We're not very picky about exactly what strings you use - for example "control", "ctrl" and "CTRL" all work for the control key.

handler function

Function to be executed when the hotkey combination is pressed. It is recommended that you define a variable to represent the handler function, as the same function must be passed in order to remove the hotkey.

cb function optional

Callback to be called after local hotkey is added.

Example
var myFunction = function () {...}
FSBL.Clients.HotkeyClient.addGlobalHotkey(["ctrl","shift","s"],myFunction,cb)

addLocalHotkey
(keyArr, handler, cb)
clients/hotkeysClient.js, line 195

Adds a local hotkey, firing only when the window calling the method is in focus. If you execute this function more than once for the same key combination, both hotkeys will coexist, and would need to be remove separately.

Name Type Description
keyArr Array.<string>

Array of strings representing hotkey key combination. We're not very picky about exactly what strings you use - for example "control", "ctrl" and "CTRL" all work for the control key.

handler function

Function to be executed when the hotkey combination is pressed. It is recommended that you define a variable to represent the handler function, as the same function must be passed in order to remove the hotkey.

cb function optional

Callback to be called after local hotkey is added.

Example
var myFunction = function () {...}
FSBL.Clients.HotkeyClient.addLocalHotkey(["ctrl","shift","s"],myFunction,cb)

onClose
(cb)
clients/hotkeysClient.js, line 338

Automatically unregisters all hotkeys when the window containing the client closes

Name Type Description
cb function

removeAllHotkeys
(cb)
clients/hotkeysClient.js, line 329

Unregisters all hotkeys, both locally and service-side.

Name Type Description
cb function

Optional callback function

removeGlobalHotkey
(keyArr, handler, cb)
clients/hotkeysClient.js, line 291

Removes a global hotkey.

Name Type Description
keyArr Array.<string>

Array of strings representing hotkey key combination. We're not very picky about exactly what strings you use - for example "control", "ctrl" and "CTRL" all work for the control key.

handler function

Handler registered for the hotkey to be removed.

cb function optional

Callback to be called after local hotkey is removed.

Example
FSBL.Clients.HotkeyClient.removeGlobalHotkey(["ctrl","shift","s"],myFunction,cb)

removeLocalHotkey
(keyArr, handler, cb)
clients/hotkeysClient.js, line 256

Removes a local hotkey.

Name Type Description
keyArr Array.<string>

Array of strings representing hotkey key combination. We're not very picky about exactly what strings you use - for example "control", "ctrl" and "CTRL" all work for the control key.

handler function

Handler registered for the hotkey to be removed.

cb function optional

Callback to be called after local hotkey is removed.

Example
FSBL.Clients.HotkeyClient.removeLocalHotkey(["ctrl","shift","s"],myFunction,cb)