This repository has been archived on 2023-11-14. You can view files and clone it, but cannot push or open issues/pull-requests.
vogue/System.js

34 lines
720 B
JavaScript

import Instance from './Instance.js';
import Serializable from './Serializable.js';
import _ from 'lodash';
const {get, set} = _;
export default class System extends Serializable {
instances = [];
modules = null;
constructor(modules, location = '.running') {
super();
this.modules = modules;
try {
mkdirSync(location);
} catch {}
this.newInstance('xyz.places.main');
}
getModule(name) {
return get(this.modules, name);
}
createInstance(name, args = {}) {
return new Instance(this.getModule(name), null, args, this);
}
newInstance(name, args = {}) {
const instance = this.createInstance(name, args);
const link = instance.link;
instance.invokeInternal('restore');
return link;
}
}