diff --git a/cocos/core/data/class.ts b/cocos/core/data/class.ts index 275a5f057f..46051661e6 100644 --- a/cocos/core/data/class.ts +++ b/cocos/core/data/class.ts @@ -195,8 +195,8 @@ function define (className, baseClass, options): any { renderName = 'render_stage'; } // 增加了 hidden: 开头标识,使它最终不会显示在 Editor inspector 的添加组件列表里 - if (globalThis.EditorExtends) { - globalThis.EditorExtends.Component.addMenu(cls, `hidden:${renderName}/${className}`, -1); + if (window.EditorExtends) { + window.EditorExtends.Component.addMenu(cls, `hidden:${renderName}/${className}`, -1); } } @@ -204,13 +204,7 @@ function define (className, baseClass, options): any { // cc-class is defined by `cc.Class({/* ... */})`. // In such case, `options.ctor` may be `undefined`. // So we can not use `options.ctor`. Instead, we should use `cls` which is the "real" registered cc-class. - // Emit via globalThis.EditorExtends to ensure the event reaches - // both the engine-internal and the scene-bundle event systems. - if (globalThis.EditorExtends) { - globalThis.EditorExtends.emit('class-registered', cls, frame, className); - } else { - EditorExtends.emit('class-registered', cls, frame, className); - } + EditorExtends.emit('class-registered', cls, frame, className); } if (frame) {