new Context(comboKeys)
Constructs a new instance of Combokeys Context
Parameters:
Name | Type | Description |
---|---|---|
comboKeys |
An instance of Combokeys |
- Source:
Methods
bind(key, contextopt, callback, action)
Bind keys to an action with an optional context
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
key |
The key combination, see Mousetrap.bind | ||
context |
<optional> |
A context for the binding, if not provided it is set to the global scope | |
callback |
The callback to call when key is pressed in context | ||
action |
The event action, see Mousetrap.bind single |
- Source:
clearContext()
Clear the content, setting to global only
- Source:
reset()
Reset this instance back to the default state, removing all bound keys
- Source:
switchContext(context)
Switch the active context
Parameters:
Name | Type | Description |
---|---|---|
context |
The active context |
- Source:
unbind(key, contextopt)
Unbind a key with an optional context
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
key |
The key combination, see Mousetrap.bind | ||
context |
<optional> |
A context for the unbinding, if not provided it will unbind the global scope |
- Source:
unbindAll(key)
Unbind all actions for a key, both global and contextual
Parameters:
Name | Type | Description |
---|---|---|
key |
The key combination, see Mousetrap.bind |
- Source: