123456789101112131415161718192021222324 |
- class InjectionSystem {
- constructor(){
- this.systems = {};
- }
- depend(SystemName, system) {
- if(this.systems[SystemName])
- return false;
- this.systems[SystemName] = system;
- return true;
- }
- inject(SystemName) {
- if(!this.systems[SystemName]) {
- console.warn("InjSys: A system was requested but not found: ", SystemName, new Error().stack);
- return false;
- }
- return this.systems[SystemName];
- }
- }
- export default new InjectionSystem();
|