Constructor
new TrayIcon(icon)
Slider TrayIcon. Creates an instance of TrayIcon UI component.
Parameters:
| Name | Type | Description |
|---|---|---|
icon | string | Icon image (relative/absolute path or base64 encoded image string). |
Example
// Create new TrayIcon
const icon = new TrayIcon("/path/to/icon.png").tooltip("New App Icon").contextMenu(existing_context_menu).show();
// Set an event handler
icon.onMouseEvents(e => {
console.log(`${e.clicks} ${e.type}`);
})
.onAction(e => {
console.log("System tray icon action was performed.");
});
// Show system message
icon.showNotification(`Warning Sample`, `This is a sample message`, MessageIcon.Warning);
// hide and show the icon
icon.hide(); // or icon.visible(false);
icons.show(); // or icon.visible(true);Classes
Methods
showNotification(title, message, iconopt) → {TrayIcon}
Displays system notification.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
title | string | Title of the notification message | ||
message | string | The message body | ||
icon | MessageIcon | <optional> | MessageIcon.Info | One of the values: MessageIcon.Info, MessageIcon.Warning, MessageIcon.Info, or |
Returns:
Returns this TrayIcon component for method chaining.
- Type:
- TrayIcon