@wener/console
Version:
Base console UI toolkit
32 lines (31 loc) • 775 B
JavaScript
import { getRootWindow } from "../../window/index.js";
const applets = [];
export function defineApplet(opts) {
const { window } = opts;
window.key ||= opts.name;
window.title ||= opts.title;
let applet = new Applet(opts);
applets.push(applet);
return applet;
}
export function getApplets() {
return applets;
}
let Applet = class Applet {
options;
constructor(options) {
this.options = options;
}
window;
toggle(opts = {}) {
if (this.window && this.window.state.minimized) {
this.window.minimize(false);
return;
}
this.window = getRootWindow().toggle({
...this.options.window,
...opts
});
}
};
//# sourceMappingURL=defineApplet.js.map