@asdf-overlay/electron 1.2.4 → 1.2.5

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.
package/lib/surface.d.ts CHANGED
@@ -37,6 +37,5 @@ export declare class ElectronOverlaySurface {
37
37
  * Copy overlay texture from bitmap surface.
38
38
  */
39
39
  private paintSoftware;
40
- private emitError;
41
40
  }
42
41
  export {};
package/lib/surface.js CHANGED
@@ -17,11 +17,15 @@ export class ElectronOverlaySurface {
17
17
  this.contents = contents;
18
18
  this.surface = OverlaySurface.create(luid);
19
19
  this.handler = (e, rect, image) => {
20
- const update = e.texture ? this.paintAccelerated(e.texture) : this.paintSoftware(rect, image);
21
- if (update) {
22
- this.window.overlay.updateHandle(this.window.id, update).catch((e) => {
23
- this.emitError(e);
24
- });
20
+ try {
21
+ const update = e.texture ? this.paintAccelerated(e.texture) : this.paintSoftware(rect, image);
22
+ if (update) {
23
+ this.window.overlay.updateHandle(this.window.id, update)
24
+ .catch((e) => this.events.emit('error', e));
25
+ }
26
+ }
27
+ catch (err) {
28
+ this.events.emit('error', err);
25
29
  }
26
30
  };
27
31
  contents.on('paint', this.handler);
@@ -58,13 +62,9 @@ export class ElectronOverlaySurface {
58
62
  src: rect,
59
63
  });
60
64
  }
61
- catch (e) {
62
- this.emitError(e);
63
- }
64
65
  finally {
65
66
  texture.release();
66
67
  }
67
- return null;
68
68
  }
69
69
  /**
70
70
  * Copy overlay texture from bitmap surface.
@@ -76,19 +76,6 @@ export class ElectronOverlaySurface {
76
76
  return null;
77
77
  }
78
78
  // TODO:: update only changed part
79
- try {
80
- return this.surface.updateBitmap(image.getSize().width, image.toBitmap());
81
- }
82
- catch (e) {
83
- this.emitError(e);
84
- }
85
- return null;
86
- }
87
- emitError(e) {
88
- if (this.events.listenerCount('error') !== 0) {
89
- this.events.emit('error', e);
90
- return;
91
- }
92
- throw e;
79
+ return this.surface.updateBitmap(image.getSize().width, image.toBitmap());
93
80
  }
94
81
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asdf-overlay/electron",
3
- "version": "1.2.4",
3
+ "version": "1.2.5",
4
4
  "description": "Asdf overlay Electron integration",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -34,7 +34,7 @@
34
34
  },
35
35
  "peerDependencies": {
36
36
  "electron": "^40.1.0",
37
- "@asdf-overlay/core": "1.2.4"
37
+ "@asdf-overlay/core": "1.2.5"
38
38
  },
39
39
  "scripts": {
40
40
  "build:dist": "tsc",