@ascua/electron 0.8.1 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -92,7 +92,9 @@ export default class extends Service {
92
92
 
93
93
  document.body.setAttribute('platform', this.platform);
94
94
 
95
- const { autoUpdater } = Remote.require('electron-updater');
95
+ const autoUpdater = this.autoUpdater;
96
+
97
+ if (!autoUpdater) return;
96
98
 
97
99
  autoUpdater.on('update-available', () => {
98
100
  this.emit('updatefound');
@@ -112,11 +114,9 @@ export default class extends Service {
112
114
 
113
115
  @action reset() {
114
116
 
115
- if (Electron === null) return;
116
-
117
- if (Remote.app.isPackaged === false) return;
117
+ const autoUpdater = this.autoUpdater;
118
118
 
119
- const { autoUpdater } = Remote.require('electron-updater');
119
+ if (!autoUpdater) return;
120
120
 
121
121
  autoUpdater.quitAndInstall(true, true);
122
122
 
@@ -132,16 +132,33 @@ export default class extends Service {
132
132
 
133
133
  if (this.updateready) return;
134
134
 
135
- if (Electron === null) return;
135
+ const autoUpdater = this.autoUpdater;
136
136
 
137
- if (Remote.app.isPackaged === false) return;
138
-
139
- const { autoUpdater } = Remote.require('electron-updater');
137
+ if (!autoUpdater) return;
140
138
 
141
139
  autoUpdater.checkForUpdates().catch(() => {});
142
140
 
143
141
  }
144
142
 
143
+ // Fetches the updater instance
144
+ // when available, or returns
145
+ // undefined if not available.
146
+
147
+ get autoUpdater() {
148
+
149
+ if (Electron === null) return undefined;
150
+
151
+ if (Remote.app.isPackaged === false) return undefined;
152
+
153
+ try {
154
+ return Remote.require('electron-updater').autoUpdater;
155
+ } catch (error) {
156
+ if (error && error.code === 'MODULE_NOT_FOUND') return undefined;
157
+ throw error;
158
+ }
159
+
160
+ }
161
+
145
162
  // When running as an Electron app,
146
163
  // then we can detect the platform
147
164
  // on which the app is running.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ascua/electron",
3
- "version": "0.8.1",
3
+ "version": "0.9.1",
4
4
  "description": "Small description for @ascua/electron goes here",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -15,8 +15,8 @@
15
15
  "url": "https://surrealdb.com"
16
16
  },
17
17
  "dependencies": {
18
- "@ascua/config": "^0.8.1",
19
- "@ascua/service": "^0.8.1",
18
+ "@ascua/config": "^0.9.1",
19
+ "@ascua/service": "^0.9.1",
20
20
  "@electron/notarize": "^3.1.1",
21
21
  "builder-util": "^26.0.11",
22
22
  "electron": "40.0.0",
@@ -33,5 +33,5 @@
33
33
  "publishConfig": {
34
34
  "access": "public"
35
35
  },
36
- "gitHead": "d3f48162b3b85f71da8252477e3c3378afca9c7e"
36
+ "gitHead": "63d4d0a87ad545de87ac7f4f7d9aa416fabee622"
37
37
  }