Skip to main content

LensStudio:CoreService.CoreService

Class

Base class for background plugin services; extend to create a service with start/stop lifecycle and access to the plugin system.

Index

Example

// CoreService manages its lifecycle through start() and stop().
// In start(), connect to signals and store the connections.
// In stop(), disconnect them to avoid leaks.

const model = this.pluginSystem.findInterface(Editor.Model.IModel) as Editor.Model.IModel;

const conn = model.onProjectChanged.connect(() => {
console.log('Project changed — new project loaded');
});
this.connections.push(conn);
console.log(`Connected to model.onProjectChanged signal`);

const scene = model.project.scene;
const so = scene.createSceneObject('CoreServiceDemo');
console.log(`Created scene object: ${so.name}`);

Extends

Constructors

Constructor

new CoreService(pluginSystem, descriptor?): CoreService

Constructs a new CoreService instance, serving as the base class for background plugin services that integrate with the Lens Studio plugin system.

Parameters

ParameterType
pluginSystemPluginSystem
descriptor?Descriptor

Returns

CoreService

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 plugin system instance used to find and access registered interfaces.

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


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


start()

start(): void

Initialize the service, set up event connections, and begin background operations.

Returns

void


stop()

stop(): void

Tear down event connections and stop all background operations.

Returns

void