ElectronApp.emit method
ElectronApp › emit
Unofficial
Emits theopen-url event, as the OS does when the user opens a URL with the application.Obsidian's main process handles it by calling
preventDefault() on the event object and opening the URL, and ignores any URL that does not start with obsidian://. Emitting it from a renderer through remote.app therefore dispatches an obsidian:// URI natively, including one that targets another vault.Signature:
emit($event: "open-url", openUrlEvent: Pick<ElectronEvent, "preventDefault">, url: string): booleanParameters:
| Parameter | Type | Description |
|---|---|---|
| $event | "open-url" | |
| openUrlEvent | Pick<ElectronEvent, "preventDefault"> | The event object. Obsidian only calls its preventDefault(). |
| url | string | The URL to open. |
Returns: boolean — Whether the event had listeners.
Unofficial
Synchronously calls each of the listeners registered for the event, in the order they were registered.Signature:
emit($event: string | symbol, args?: unknown[]): booleanParameters:
| Parameter | Type | Description |
|---|---|---|
| $event | string | symbol | |
| args? | unknown[] | The arguments passed to the listeners. |
Returns: boolean — Whether the event had listeners.