Application
Members
Description
Gets or sets if the application should quit (or exit returning 0) when the last remaining window is closed (Note: hidden windows still count as open windows and will prevent applications from closing). The default for this is true.
Description
The icon property allows you to set or get the current image associated with the application (and subsequently used in the dock/task bar or on window decorations). The string must be a valid URL or path to an image on the file system or application resource (For best results use 512x512 PNG image).
Description
The name property is used to get or set the process name in the task manager, or when the application is shown. Note that the packaged application name should match this name.
Description
Gets a true or false boolean value if the application is packaged or is being ran as a script.
Description
Gets or sets the visibility of the application. This will reveal or hide all windows associated with the application. Note that other OS/UI elements may not be hidden, such as modal dialogs, or indicator icons in the taskbar.
Methods
Description
Adds an event listener for various application level events. The first parameter is the name of the event, the second parameter is the function to call when the event happens (e.g., a callback).
Parameters
Name | Type | Description |
---|---|---|
eventName | string | The name of the application event to start listening to. |
callback | function | The function that will be called when it occurs. |
Description
Animates the icon in the dock or task bar to "bounce" (on OSX) or "highlight" (in Windows). If false (or nothing) is passed into this the animation is played for a short time (depending on OS preferences), if true is passed in (e.g., a critical alert is needed) the icon continues to animate until a window or the application icon in the dock is clicked.
Parameters
Name | Type | Description |
---|---|---|
critical | boolean |
Returns
Type | Description |
---|---|
Object | An object with one function "cancel" allowing you to cancel the request. |
Description
Invokes a copy operation, this takes whatever is currently selected in the focused window and control and places it into the clipboard.
Description
Invokes a cut operation, this takes whatever is currently selected in the focused window and control and places it into the clipboard and removes the selected element from the application (usually text or images)
Description
Deletes the currently selected value for the currently focused window and control.
Description
Invokes a paste operation, this takes whatever is currently in the clipboard and sends a paste operation to the focused window and control.
Description
This repeats the last rewound value of the currently focused window and control.
Description
The registerHotKey function attempts to assign a global hot key (or shortcut keyboard command) for the application. If a global hot key cannot be registered it assignts it as a local (application) hot key, if that is unsuccessful the successful property in the return object is set to false. Note the hot key may not be registered as a global hot key depending on security settings on Windows, or due to accessibility settings on OSX. Application entitlements or manually setting the application as an accessible or elevated privileged application will allow it to register a global hot key. To register a normal hot key, it's customary to use the Menu and MenuItem classes.
Parameters
Name | Type | Description |
---|---|---|
key | string | The character for the hot key, for example copy or ctrl+C, the character would be 'c', case does not matter. |
modifiers | string | A comma delimited list of modifiers, options are 'alt', 'ctrl', 'cmd', or 'shift'. For example 'shift,ctrl' |
callback | function | The function executed when the hot key or shortcut is pressed. |
Returns
Type | Description |
---|---|
Object | An object with the properites: {global,successful,unregister}. 'global' indicates if the hot key successfully registered beyond the application context, 'successful' if the registeration was accepted by the OS, and 'unregister' is a function that can be executed to remove the hot key registration. |
Description
Removes an event listener for various application level events. The first parameter is the name of the event, the second parameter is the function that was originally given as the callback for addEventListener.
Parameters
Name | Type | Description |
---|---|---|
eventName | string | The name of the application event to stop listening to. |
callback | function | The function that would have been called. |
Description
Takes a path to an application resource and returns a Buffer object. This is useful if you need to get access to packaged resources.
Parameters
Name | Type | Description |
---|---|---|
path | string |
Returns
Type | Description |
---|---|
Buffer |
Description
Selects all the values in the UI of the currently focused window and control.
Description
This rewinds a controls value (e.g., perhaps text in a textbox) for the currently focused window and control.
Description
Removes all hot keys assigned by the application (with the exception of Menu related hot keys).