Skip to content

Commit 0e92b78

Browse files
committed
fix: build errors on macOS and Linux, fixes #6
1 parent 057de20 commit 0e92b78

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

package-lock.json

Lines changed: 4 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-window-manager",
3-
"version": "0.8.1",
3+
"version": "0.8.2",
44
"description": "Manage windows in macOS, Windows and Linux",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/classes/window.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ import { basename } from "path";
22
import { platform } from "os";
33
import { windowManager } from "..";
44

5-
const addon = require("bindings")("addon");
5+
let addon: any;
6+
7+
if (platform() === "win32") {
8+
addon = require("bindings")("addon");
9+
}
610

711
interface Process {
812
id: number;
@@ -24,6 +28,8 @@ export class Window {
2428
constructor(handle: number) {
2529
this.handle = handle;
2630

31+
if (platform() !== "win32") return;
32+
2733
const processId = addon.getWindowProcessId(handle);
2834
const processPath = addon.getProcessPath(processId);
2935

src/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ import { Window } from "./classes/window";
22
import { EventEmitter } from "events";
33
import { platform, release } from "os";
44

5-
const addon = require("bindings")("addon");
5+
let addon: any;
6+
7+
if (platform() === "win32") {
8+
addon = require("bindings")("addon");
9+
}
610

711
let interval: any = null;
812

0 commit comments

Comments
 (0)