MCPcopy Create free account
hub / github.com/esengine/esengine / remove

Method remove

packages/effect/src/core/EffectContainer.ts:254–276  ·  view source on GitHub ↗

* @zh 移除效果 * @en Remove effect * * @param instanceId - @zh 实例 ID @en Instance ID

(instanceId: string)

Source from the content-addressed store, hash-verified

252 * @param instanceId - @zh 实例 ID @en Instance ID
253 */
254 remove(instanceId: string): boolean {
255 const effect = this._effects.get(instanceId);
256 if (!effect) return false;
257
258 effect.isActive = false;
259
260 // Call handler
261 const handler = this._handlers.get(effect.definition.typeId);
262 handler?.onRemove?.(effect, this._target);
263
264 // Remove from collections
265 this._effects.delete(instanceId);
266 this._effectsByType.get(effect.definition.typeId)?.delete(instanceId);
267
268 for (const tag of effect.definition.tags) {
269 this._effectsByTag.get(tag)?.delete(instanceId);
270 }
271
272 // Emit event
273 this._emitEvent('removed', effect);
274
275 return true;
276 }
277
278 /**
279 * @zh 按类型移除效果

Callers 5

_handleStackingMethod · 0.95
removeByTypeMethod · 0.95
removeByTagMethod · 0.95
removeAllMethod · 0.95
updateMethod · 0.95

Calls 4

_emitEventMethod · 0.95
onRemoveMethod · 0.80
getMethod · 0.65
deleteMethod · 0.65

Tested by

no test coverage detected