LensStudio:UriHandlerPlugin.UriHandlerPlugin
ClassConstructs a URI handler plugin instance bound to the given plugin system and optional descriptor.
Index
Properties
Methods
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
| Parameter | Type |
|---|---|
pluginSystem | PluginSystem |
descriptor? | Descriptor |
Returns
UriHandlerPlugin
Overrides
Editor.IPlugin.constructor
Properties
id
readonlyid:string
Unique string identifier of the plugin instance.
Inherited from
pluginSystem
readonlypluginSystem:PluginSystem
The PluginSystem instance this plugin is registered with.
Methods
getTypeName()
staticgetTypeName():string
Returns the type name of this class.
Returns
string
Overrides
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
handle()
handle(
uri):boolean
Handles a URI string and returns whether it was successfully processed.
Parameters
| Parameter | Type |
|---|---|
uri | string |
Returns
boolean
isOfType()
isOfType(
type):boolean
Returns true if the object is of the specified type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
isSame()
isSame(
other):boolean
Returns true if this object refers to the same instance as the given object.
Parameters
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean