shared
utils
string
object
is
extension
js
tracking
string
dom
when
selection
position
iframe
event
scroll
console
node
string
project
fs
console
escapeQueue
Type:Function
Status:stable
Since:1.0.0
Platform:js
@blackbyte.sugar.js.keyboard
This funciton allows you to register actions to execute when user press the escape key.
It will take care of executing the last registered action first, then the others…
This function returns a SPromise instance on which you can call the cancel method to unregister your
action in the queue.
Note that you can get the current queue length by calling escapeQueueLength().
Params
- callbacknullFunction
The callback to call on pressing escape
- settings{}Object
An option object to configure your hotkey. Here’s the list of available settings:
Return
- -SPromise
An SPromise instance that will be resolved when the user has pressed the escape key and that it’s yout turn in the queue
Example
import { escapeQueue } from '@blackbyte/sugar/keyboard'
const promise = escapeQueue();
promise.then(() => {
// do something...
});
// if you want to cancel your subscription
promise.cancel();Settings
- ctxdocumentHTMLElement
Specify where to add the listener
- id-String
Specify an id. If specified, will before unqueue the previous item with the same id and add it again
Todo
- testsnormal
Author
- Olivier Bosselolivier.bossel@gmail.comhttps://blackbyte.space