Skip to main content

LensStudio:UriHandlerPlugin.UriHandlerPlugin

Class

Constructs a URI handler plugin instance bound to the given plugin system and optional descriptor.

Index

Example

// UriHandlerPlugin is the base class for plugins that respond to custom
// URI deep-links.
//
// Members:
// handle(uri: string): boolean — process the URI, return true if handled
// pluginSystem (readonly) — access to the plugin system

export class UriHandlerPluginClassExampleHandler extends UriHandlerPlugin {
connections: any[];
static descriptor() {
const d = new Descriptor();
d.id = 'com.docs.UriHandlerPluginClassExample';
d.name = 'URI Handler Class Example';
d.description = 'Demonstrates UriHandlerPlugin class with handle()';
d.canHandle = (uri: string) => uri.startsWith('lensstudio://action/');
return d;
}
constructor(pluginSystem: Editor.PluginSystem, descriptor?: Descriptor) {
super(pluginSystem, descriptor);
this.connections = [];
}
handle(uri: string): boolean {
const action = uri.replace('lensstudio://action/', '');
console.log(`Processing action: ${action}`);
// Return true to indicate the URI was handled
return true;
}
}

Extends

Constructors

Constructor

new UriHandlerPlugin(pluginSystem, descriptor?): UriHandlerPlugin

Constructs a UriHandlerPlugin instance with the given plugin system and optional descriptor.

Parameters

ParameterType
pluginSystemPluginSystem
descriptor?Descriptor

Returns

UriHandlerPlugin

Overrides

Editor.IPlugin.constructor

Properties

id

readonly id: string

Unique string identifier of the plugin instance.

Inherited from

IPlugin.id


pluginSystem

readonly pluginSystem: PluginSystem

The PluginSystem instance this plugin is registered with.

Methods

getTypeName()

static getTypeName(): string

Returns the type name of this class.

Returns

string

Overrides

IPlugin.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

IPlugin.getTypeName


handle()

handle(uri): boolean

Handles a URI string and returns whether it was successfully processed.

Parameters

ParameterType
uristring

Returns

boolean


isOfType()

isOfType(type): boolean

Returns true if the object is of the specified type.

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

IPlugin.isOfType


isSame()

isSame(other): boolean

Returns true if this object refers to the same instance as the given object.

Parameters

ParameterType
otherScriptObject

Returns

boolean

Inherited from

IPlugin.isSame