MCPcopy Index your code
hub / github.com/esengine/esengine / dispose

Method dispose

packages/runtime-core/src/UserCodeRealm.ts:588–612  ·  view source on GitHub ↗

* @zh 释放隔离域 * @en Dispose the realm * * @zh 完全清理所有资源。释放后隔离域不可再使用。 * @en Completely clean up all resources. Realm cannot be used after disposal.

()

Source from the content-addressed store, hash-verified

586 * @en Completely clean up all resources. Realm cannot be used after disposal.
587 */
588 dispose(): void {
589 if (this._disposed) {
590 return;
591 }
592
593 // 移除所有系统 | Remove all systems
594 for (const info of this._systems) {
595 try {
596 info.scene.removeSystem(info.instance);
597 } catch {
598 // 忽略错误 | Ignore errors
599 }
600 }
601 this._systems = [];
602
603 // 清除组件 | Clear components
604 this._components.clear();
605 this._componentRegistry.reset();
606
607 // 清除服务 | Clear services
608 this._serviceRegistry.dispose();
609
610 this._disposed = true;
611 logger.info('UserCodeRealm disposed');
612 }
613
614 /**
615 * @zh 检查是否已释放

Callers

nothing calls this directly

Calls 5

removeSystemMethod · 0.65
clearMethod · 0.65
resetMethod · 0.65
disposeMethod · 0.65
infoMethod · 0.45

Tested by

no test coverage detected