ElectronTray.once method
ElectronTray › once
Unofficial
Registers a one-time listener that is invoked when the tray balloon is clicked.win32 only.Signature:
once($event: "balloon-click", listener: () => void): thisParameters:
| Parameter | Type | Description |
|---|---|---|
| $event | "balloon-click" | |
| listener | () => void | The event handler. |
Returns: this — This tray instance.
Unofficial
Registers a one-time listener that is invoked when the tray balloon is closed because of timeout or user manually closes it.win32 only.Signature:
once($event: "balloon-closed", listener: () => void): thisParameters:
| Parameter | Type | Description |
|---|---|---|
| $event | "balloon-closed" | |
| listener | () => void | The event handler. |
Returns: this — This tray instance.
Unofficial
Registers a one-time listener that is invoked when the tray balloon shows.win32 only.Signature:
once($event: "balloon-show", listener: () => void): thisParameters:
| Parameter | Type | Description |
|---|---|---|
| $event | "balloon-show" | |
| listener | () => void | The event handler. |
Returns: this — This tray instance.
Unofficial
Registers a one-time listener that is invoked when the tray icon is clicked.Signature:
once($event: "click", listener: ($event: ElectronKeyboardEvent, bounds: ElectronRectangle, position: ElectronPoint) => void): thisParameters:
| Parameter | Type | Description |
|---|---|---|
| $event | "click" | |
| listener | ($event: ElectronKeyboardEvent, bounds: ElectronRectangle, position: ElectronPoint) => void | The event handler receiving the event, the bounds of the tray icon, and the position of the event. |
Returns: this — This tray instance.
Unofficial
Registers a one-time listener that is invoked when the tray icon is double clicked.darwin and win32 only.Signature:
once($event: "double-click", listener: ($event: ElectronKeyboardEvent, bounds: ElectronRectangle) => void): thisParameters:
| Parameter | Type | Description |
|---|---|---|
| $event | "double-click" | |
| listener | ($event: ElectronKeyboardEvent, bounds: ElectronRectangle) => void | The event handler receiving the event and the bounds of the tray icon. |
Returns: this — This tray instance.
Unofficial
Registers a one-time listener that is invoked when a drag operation ends on the tray or ends at another location.darwin only.Signature:
once($event: "drag-end", listener: () => void): thisParameters:
| Parameter | Type | Description |
|---|---|---|
| $event | "drag-end" | |
| listener | () => void | The event handler. |
Returns: this — This tray instance.
Unofficial
Registers a one-time listener that is invoked when a drag operation enters the tray icon.darwin only.Signature:
once($event: "drag-enter", listener: () => void): thisParameters:
| Parameter | Type | Description |
|---|---|---|
| $event | "drag-enter" | |
| listener | () => void | The event handler. |
Returns: this — This tray instance.
Unofficial
Registers a one-time listener that is invoked when a drag operation exits the tray icon.darwin only.Signature:
once($event: "drag-leave", listener: () => void): thisParameters:
| Parameter | Type | Description |
|---|---|---|
| $event | "drag-leave" | |
| listener | () => void | The event handler. |
Returns: this — This tray instance.
Unofficial
Registers a one-time listener that is invoked when any dragged items are dropped on the tray icon.darwin only.Signature:
once($event: "drop", listener: () => void): thisParameters:
| Parameter | Type | Description |
|---|---|---|
| $event | "drop" | |
| listener | () => void | The event handler. |
Returns: this — This tray instance.
Unofficial
Registers a one-time listener that is invoked when dragged files are dropped in the tray icon.darwin only.Signature:
once($event: "drop-files", listener: ($event: ElectronEvent, files: string[]) => void): thisParameters:
| Parameter | Type | Description |
|---|---|---|
| $event | "drop-files" | |
| listener | ($event: ElectronEvent, files: string[]) => void | The event handler receiving the event and the paths of the dropped files. |
Returns: this — This tray instance.
Unofficial
Registers a one-time listener that is invoked when dragged text is dropped in the tray icon.darwin only.Signature:
once($event: "drop-text", listener: ($event: ElectronEvent, text: string) => void): thisParameters:
| Parameter | Type | Description |
|---|---|---|
| $event | "drop-text" | |
| listener | ($event: ElectronEvent, text: string) => void | The event handler receiving the event and the dropped text string. |
Returns: this — This tray instance.
Unofficial
Registers a one-time listener that is invoked when the mouse clicks the tray icon.darwin only.Signature:
once($event: "mouse-down", listener: ($event: ElectronKeyboardEvent, position: ElectronPoint) => void): thisParameters:
| Parameter | Type | Description |
|---|---|---|
| $event | "mouse-down" | |
| listener | ($event: ElectronKeyboardEvent, position: ElectronPoint) => void | The event handler receiving the event and the position of the event. |
Returns: this — This tray instance.
Unofficial
Registers a one-time listener that is invoked when the mouse enters the tray icon.darwin only.Signature:
once($event: "mouse-enter", listener: ($event: ElectronKeyboardEvent, position: ElectronPoint) => void): thisParameters:
| Parameter | Type | Description |
|---|---|---|
| $event | "mouse-enter" | |
| listener | ($event: ElectronKeyboardEvent, position: ElectronPoint) => void | The event handler receiving the event and the position of the event. |
Returns: this — This tray instance.
Unofficial
Registers a one-time listener that is invoked when the mouse exits the tray icon.darwin only.Signature:
once($event: "mouse-leave", listener: ($event: ElectronKeyboardEvent, position: ElectronPoint) => void): thisParameters:
| Parameter | Type | Description |
|---|---|---|
| $event | "mouse-leave" | |
| listener | ($event: ElectronKeyboardEvent, position: ElectronPoint) => void | The event handler receiving the event and the position of the event. |
Returns: this — This tray instance.
Unofficial
Registers a one-time listener that is invoked when the mouse moves in the tray icon.darwin and win32 only.Signature:
once($event: "mouse-move", listener: ($event: ElectronKeyboardEvent, position: ElectronPoint) => void): thisParameters:
| Parameter | Type | Description |
|---|---|---|
| $event | "mouse-move" | |
| listener | ($event: ElectronKeyboardEvent, position: ElectronPoint) => void | The event handler receiving the event and the position of the event. |
Returns: this — This tray instance.
Unofficial
Registers a one-time listener that is invoked when the mouse is released from clicking the tray icon.Note: This will not be emitted if you have set a context menu for your tray using ElectronTray.setContextMenu, as a result of macOS-level constraints.
darwin only.Signature:
once($event: "mouse-up", listener: ($event: ElectronKeyboardEvent, position: ElectronPoint) => void): thisParameters:
| Parameter | Type | Description |
|---|---|---|
| $event | "mouse-up" | |
| listener | ($event: ElectronKeyboardEvent, position: ElectronPoint) => void | The event handler receiving the event and the position of the event. |
Returns: this — This tray instance.
Unofficial
Registers a one-time listener that is invoked when the tray icon is right clicked.darwin and win32 only.Signature:
once($event: "right-click", listener: ($event: ElectronKeyboardEvent, bounds: ElectronRectangle) => void): thisParameters:
| Parameter | Type | Description |
|---|---|---|
| $event | "right-click" | |
| listener | ($event: ElectronKeyboardEvent, bounds: ElectronRectangle) => void | The event handler receiving the event and the bounds of the tray icon. |
Returns: this — This tray instance.