@animech-public/playcanvas
Version:
PlayCanvas WebGL game engine
2 lines (1 loc) • 1.02 kB
JavaScript
import{EventHandler as i}from"../../core/event-handler.js";class t extends i{constructor(){super(),this.anim=void 0,this.animation=void 0,this.audiolistener=void 0,this.audiosource=void 0,this.button=void 0,this.camera=void 0,this.collision=void 0,this.element=void 0,this.joint=void 0,this.layoutchild=void 0,this.layoutgroup=void 0,this.light=void 0,this.model=void 0,this.particlesystem=void 0,this.render=void 0,this.rigidbody=void 0,this.screen=void 0,this.script=void 0,this.scrollbar=void 0,this.scrollview=void 0,this.sound=void 0,this.sprite=void 0,this.zone=void 0,this.list=[]}add(i){const t=i.id;if(this[t])throw new Error(`ComponentSystem name '${t}' already registered or not allowed`);this[t]=i,this.list.push(i)}remove(i){const t=i.id;if(!this[t])throw new Error(`No ComponentSystem named '${t}' registered`);delete this[t];const s=this.list.indexOf(this[t]);-1!==s&&this.list.splice(s,1)}destroy(){this.off();for(let i=0;i<this.list.length;i++)this.list[i].destroy()}}export{t as ComponentSystemRegistry};