Editor.IGuard
ClassRepresents ownership of a resource.
Represents ownership of a resource.
If this object is garbage collected, or dispose() method is called – the associated resource is freed.
Index
Example
// IGuard represents ownership of a registered resource.
// Store the guard and call dispose() in stop() to unregister cleanly.
const registry = this.pluginSystem.findInterface(
Editor.IContextActionRegistry.interfaceId
) as Editor.IContextActionRegistry;
if (Editor.isNull(registry)) {
console.log('IContextActionRegistry not available');
return;
}
const guard: Editor.IGuard = registry.registerAction(
(ctx: Editor.IContext) => {
console.log('Context action triggered');
return undefined as unknown as Editor;
}
);
this.guards.push(guard);
console.log('Context action registered, guard stored for cleanup');
Extends
Extended by
Methods
dispose()
dispose():
void
Free the guarded resource immediately.
Returns
void
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