Skip to content

Files

Latest commit

 

History

History
42 lines (31 loc) · 842 Bytes

README.md

File metadata and controls

42 lines (31 loc) · 842 Bytes
description full_title
This tutorial demonstrates how to create and manage tray icons.
Tray Tutorial

Tray Tutorial

This tutorial demonstrates how to create and manage tray icons.

Example

Usage

You can spawn a tray entry using:

const entry = core.make('osjs/tray', {
  title: 'My Tray Icon',
  icon: 'icon.src',
  onclick: ev => console.log('clicked'),
  oncontextmenu: ev => console.log('contextmenu')
});

If you're using this in a application, you probably want to destroy it when the user quits the application:

proc.on('destroy', () => entry.destroy());

To update the tray entry:

const entry = core.make('osjs/tray', {
  title: 'My Tray Icon'
});

// Takes the same arguments as creation
entry.update({
  title: 'My Tray Icon, but updated'
});