Skip to main content

LensStudio:UriHandlerPlugin.Descriptor

Class

Descriptor for a URI handler plugin, including a predicate function to determine if the handler can process a given URI.

Index

Example

// UriHandlerPlugin Descriptor extends BaseDescriptor with:
//
// canHandle: (uri: string) => boolean
// Callback that determines whether this handler can process the given URI.
// Set this before returning the descriptor from the static descriptor() method.

export class UriHandlerDescriptorExampleHandler extends UriHandlerPlugin {
connections: any[];
static descriptor() {
const d = new Descriptor();
d.id = 'com.docs.UriHandlerDescriptorExample';
d.name = 'URI Descriptor Example';
d.description = 'Demonstrates UriHandlerPlugin Descriptor with canHandle';
// canHandle filters which URIs route to this plugin
d.canHandle = (uri: string) => {
return uri.startsWith('lensstudio://docs/');
};
return d;
}
constructor(pluginSystem: Editor.PluginSystem, descriptor?: Descriptor) {
super(pluginSystem, descriptor);
this.connections = [];
}
handle(uri: string): boolean {
const path = uri.replace('lensstudio://docs/', '');
console.log(`Handling docs URI path: ${path}`);
return true;
}
}

Extends

Constructors

Constructor

new Descriptor(): Descriptor

Constructs a new UriHandlerPlugin descriptor instance.

Returns

Descriptor

Overrides

BaseDescriptor.constructor

Properties

canHandle

canHandle: (arg1) => any

Callback that determines whether this handler can instantiate the given asset.

Parameters

ParameterType
arg1string

Returns

any


dependencies

dependencies: InterfaceId[]

Array of interface IDs that this plugin requires to function.

Inherited from

BaseDescriptor.dependencies


description

description: string

Human-readable description of the plugin shown in the plugin manager.

Inherited from

BaseDescriptor.description


id

id: string

Unique identifier for the plugin, typically in reverse domain notation.

Inherited from

BaseDescriptor.id


intendedPlatforms

intendedPlatforms: TargetPlatform[]

Array of target platforms (Snapchat, Spectacles) where this plugin is intended to run.

Inherited from

BaseDescriptor.intendedPlatforms


interfaces

interfaces: InterfaceId[]

Array of interface IDs that this plugin provides or implements.

Inherited from

BaseDescriptor.interfaces


name

name: string

Display name of the plugin.

Inherited from

BaseDescriptor.name

Methods

getTypeName()

static getTypeName(): string

Returns the type name of this class.

Returns

string

Overrides

BaseDescriptor.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

BaseDescriptor.getTypeName


isOfType()

isOfType(type): boolean

Returns true if the object is of the specified type.

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

BaseDescriptor.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

BaseDescriptor.isSame