Skip to content

Workspace.on('url-menu') method

Workspace › on(‘url-menu’)

Official

Triggered when the user opens the context menu on an external URL.

Signature:

on(name: "url-menu", callback: (menu: Menu, url: string) => unknown, ctx?: unknown): EventRef

Parameters:

ParameterTypeDescription
name"url-menu"Should be 'url-menu'.
callback(menu: Menu, url: string) => unknownThe callback function.
ctx?unknownThe context passed as this to the callback function.

Returns: EventRefThe event reference.

Example:

app.workspace.on('url-menu', (menu, url) => {
console.log(menu, url);
});