- Home
- Classes
- linkedin-tool~Shortcut
-
new Shortcut( seq, desc, func )
-
Description
Self-decorating class useful for integrating with a hotkey service.
Parameters
Name Type Description seqstring Key sequence to activate this function.
descstring Human readable documentation about this function.
funcNexusHoratio.web~SimpleFunction Function to wrap, usually in the form of an arrow function. Keep JS
thismagic in mind!Examples
// Wrap an arrow function: foo = new Shortcut( 'c-c', 'Clear the console.', () => { console.clear(); console.log('I did it!', this); } ); // Search for instances: const keys = []; for (const prop of Object.values(this)) { if (prop instanceof Shortcut) { keys.push({seq: prop.seq, desc: prop.seq, func: prop}); } } ... Send keys off to service ...Details