Adds a listener to the end of the listeners array for the specified event.
Optional
options: SubscriptionOptionsAdds a listener to the end of the listeners array for the specified event.
Optional
options: SubscriptionOptionsEvent payloads are documented in the OpenFin.Events namespace.
Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed.
Optional
options: SubscriptionOptionsEvent payloads are documented in the OpenFin.Events namespace.
Adds a listener to the beginning of the listeners array for the specified event.
Optional
options: SubscriptionOptionsEvent payloads are documented in the OpenFin.Events namespace.
Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed. The listener is added to the beginning of the listeners array.
Optional
options: SubscriptionOptionsEvent payloads are documented in the OpenFin.Events namespace.
Registers a global hotkey with the operating system.
a hotkey string
called when the registered hotkey is pressed by the user.
Rest
...args: any[]If the hotkey
is reserved, see list below.
if the hotkey
is already registered by another application.
The hotkey
parameter expects an electron compatible accelerator and the listener
will be called if the hotkey
is pressed by the user.
If successfull, the hotkey will be 'claimed' by the application, meaning that this register call can be called multiple times from within the same application but will fail if another application has registered the hotkey.
The register call will fail if given any of these reserved Hotkeys:
CommandOrControl+0
CommandOrControl+=
CommandOrControl+Plus
CommandOrControl+-
CommandOrControl+_
CommandOrControl+Shift+I
F5
CommandOrControl+R
Shift+F5
CommandOrControl+Shift+R
Raises the registered
event.
const hotkey = 'CommandOrControl+X';
fin.GlobalHotkey.register(hotkey, () => {
console.log(`${hotkey} pressed`);
})
.then(() => {
console.log('Success');
})
.catch(err => {
console.log('Error registering the hotkey', err);
});
Removes all listeners, or those of the specified event.
Optional
eventType: "registered" | "unregistered"Remove a listener from the listener array for the specified event.
Optional
options: SubscriptionOptionsUnregisters a global hotkey with the operating system.
a hotkey string
This method will unregister all existing registrations of the hotkey within the application.
Raises the unregistered
event.
const hotkey = 'CommandOrControl+X';
fin.GlobalHotkey.unregister(hotkey)
.then(() => {
console.log('Success');
})
.catch(err => {
console.log('Error unregistering the hotkey', err);
});
The GlobalHotkey module can register/unregister a global hotkeys.