Provides access to the OpenFin representation of the current code context (usually a document
such as a View or Window), as well as to the current Interop
context.
Useful for debugging in the devtools console, where this will intelligently type itself based on the context in which the devtools panel was opened.
Adds a listener to the end of the listeners array for the specified event.
Optional
options: SubscriptionOptionsChecks if a given hotkey has been registered by an application within the current runtime.
a hotkey string
const hotkey = 'CommandOrControl+X';
fin.GlobalHotkey.isRegistered(hotkey)
.then((registered) => {
console.log(`hotkey ${hotkey} is registered ? ${registered}`);
})
.catch(err => {
console.log('Error unregistering the hotkey', err);
});
Adds a listener to the end of the listeners array for the specified event.
Optional
options: SubscriptionOptionsEvent payloads are documented in the 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 Events namespace.
Adds a listener to the beginning of the listeners array for the specified event.
Optional
options: SubscriptionOptionsEvent payloads are documented in the 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 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: SubscriptionOptionsCaution: Calling this method changes the array indices in the listener array behind the listener.
Unregisters 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);
});
Unregisters all global hotkeys for the current application.
Raises the unregistered
event for each hotkey unregistered.
fin.GlobalHotkey.unregisterAll()
.then(() => {
console.log('Success');
})
.catch(err => {
console.log('Error unregistering all hotkeys for this application', err);
});
The GlobalHotkey module can register/unregister a global hotkeys.