@minimaltech/electron-infra
Version:
Minimal Technology ElectronJS Infrastructure
46 lines • 1.82 kB
JavaScript
;
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BrowserWindow = void 0;
const node_infra_1 = require("@minimaltech/node-infra");
const node_infra_2 = require("@minimaltech/node-infra");
const electron_1 = require("electron");
class BrowserWindow extends electron_1.BrowserWindow {
constructor(opts) {
const { identifier, name, url } = opts, rest = __rest(opts, ["identifier", "name", "url"]);
super(rest);
this.identifier = identifier !== null && identifier !== void 0 ? identifier : (0, node_infra_1.getUID)();
this.name = name;
this.url = url;
this.loadUI();
}
getIdentifier() {
return this.identifier;
}
getName() {
return this.name;
}
loadUI(opts) {
var _a;
const url = (_a = opts === null || opts === void 0 ? void 0 : opts.url) !== null && _a !== void 0 ? _a : this.url;
if (!url) {
throw (0, node_infra_2.getError)({
statusCode: node_infra_1.ResultCodes.RS_5.InternalServerError,
message: `[load] Identifier: ${this.identifier} | Name: ${this.name} | Invalid url to load!`,
});
}
this.loadURL(url);
}
}
exports.BrowserWindow = BrowserWindow;
//# sourceMappingURL=browser-window.model.js.map