TrayIcon

TrayIcon is a system icon usually displayed in a tray of icons for applications running or capable of running in the background.

TrayIcon component is able to show system notification messages, have context menu and show tooltip text on mouse hover.

Constructor

new TrayIcon(icon)

Slider TrayIcon. Creates an instance of TrayIcon UI component.

Parameters:
NameTypeDescription
iconstring

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

TrayIcon

Methods

showNotification(title, message, iconopt) → {TrayIcon}

Displays system notification.

Parameters:
NameTypeAttributesDefaultDescription
titlestring

Title of the notification message

messagestring

The message body

iconMessageIcon<optional>
MessageIcon.Info

One of the values: MessageIcon.Info, MessageIcon.Warning, MessageIcon.Info, or null to not show any icon.

Returns:

Returns this TrayIcon component for method chaining.

Type: 
TrayIcon