LensStudio:CoreService.CoreService
ClassBase class for background plugin services; extend to create a service with start/stop lifecycle and access to the plugin system.
Index
Properties
Methods
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
| Parameter | Type |
|---|---|
pluginSystem | PluginSystem |
descriptor? | Descriptor |
Returns
CoreService
Overrides
Editor.IPlugin.constructor
Properties
id
readonlyid:string
Unique string identifier of the plugin instance.
Inherited from
pluginSystem
readonlypluginSystem:PluginSystem
The plugin system instance used to find and access registered interfaces.
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
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
Inherited from
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