Adds a listener to the end of the listeners array for the specified event.
Optionaloptions: SubscriptionOptionsAdds a listener to the end of the listeners array for the specified event.
Optionaloptions: 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.
Optionaloptions: SubscriptionOptionsEvent payloads are documented in the OpenFin.Events namespace.
Adds a listener to the beginning of the listeners array for the specified event.
Optionaloptions: 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.
Optionaloptions: 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+0CommandOrControl+=CommandOrControl+PlusCommandOrControl+-CommandOrControl+_CommandOrControl+Shift+IF5CommandOrControl+RShift+F5CommandOrControl+Shift+RRaises 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.
OptionaleventType: "registered" | "unregistered"Remove a listener from the listener array for the specified event.
Optionaloptions: 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.