1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.ElectronAppAdapter = void 0;
|
7 |
|
8 | var path = _interopRequireWildcard(require("path"));
|
9 |
|
10 | function _AppAdapter() {
|
11 | const data = require("./AppAdapter");
|
12 |
|
13 | _AppAdapter = function () {
|
14 | return data;
|
15 | };
|
16 |
|
17 | return data;
|
18 | }
|
19 |
|
20 | function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
21 |
|
22 | function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
23 |
|
24 | class ElectronAppAdapter {
|
25 | constructor(app = require("electron").app) {
|
26 | this.app = app;
|
27 | }
|
28 |
|
29 | whenReady() {
|
30 | return this.app.whenReady();
|
31 | }
|
32 |
|
33 | get version() {
|
34 | return this.app.getVersion();
|
35 | }
|
36 |
|
37 | get name() {
|
38 | return this.app.getName();
|
39 | }
|
40 |
|
41 | get isPackaged() {
|
42 | return this.app.isPackaged === true;
|
43 | }
|
44 |
|
45 | get appUpdateConfigPath() {
|
46 | return this.isPackaged ? path.join(process.resourcesPath, "app-update.yml") : path.join(this.app.getAppPath(), "dev-app-update.yml");
|
47 | }
|
48 |
|
49 | get userDataPath() {
|
50 | return this.app.getPath("userData");
|
51 | }
|
52 |
|
53 | get baseCachePath() {
|
54 | return (0, _AppAdapter().getAppCacheDir)();
|
55 | }
|
56 |
|
57 | quit() {
|
58 | this.app.quit();
|
59 | }
|
60 |
|
61 | onQuit(handler) {
|
62 | this.app.once("quit", (_, exitCode) => handler(exitCode));
|
63 | }
|
64 |
|
65 | } exports.ElectronAppAdapter = ElectronAppAdapter;
|
66 |
|
67 |
|
\ | No newline at end of file |