positron.js 1.0.0 → 1.0.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.
- package/core/win/main.cs +3 -4
- package/index.js +33 -3
- package/package.json +2 -3
package/core/win/main.cs
CHANGED
|
@@ -102,11 +102,10 @@ namespace PositronWindows
|
|
|
102
102
|
|
|
103
103
|
public static bool IsPackaged { get; private set; } = false;
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
public static IPCClient _ipcClient = null!;
|
|
106
106
|
private static Process? _nodeProcess;
|
|
107
107
|
|
|
108
|
-
|
|
109
|
-
private static readonly Dictionary<int, Window> WindowsMap = new();
|
|
108
|
+
public static readonly Dictionary<int, Window> WindowsMap = new();
|
|
110
109
|
private static readonly Dictionary<int, DockPanel> LayoutMap = new();
|
|
111
110
|
private static readonly Dictionary<int, Menu> MenuMap = new();
|
|
112
111
|
private static readonly HashSet<int> _forceClosing = new();
|
|
@@ -819,7 +818,7 @@ case "setBounds":
|
|
|
819
818
|
}
|
|
820
819
|
}
|
|
821
820
|
|
|
822
|
-
|
|
821
|
+
public static WebView2? GetWebView(int windowId)
|
|
823
822
|
{
|
|
824
823
|
if (LayoutMap.TryGetValue(windowId, out var layout))
|
|
825
824
|
{
|
package/index.js
CHANGED
|
@@ -226,6 +226,8 @@ let _windowCounter = 0;
|
|
|
226
226
|
|
|
227
227
|
class Window extends Events.EventEmitter {
|
|
228
228
|
|
|
229
|
+
id = 0;
|
|
230
|
+
|
|
229
231
|
/** Creates a new window instance. */
|
|
230
232
|
constructor(options = {
|
|
231
233
|
|
|
@@ -592,6 +594,15 @@ async request(command, replyChannel, ...args) {
|
|
|
592
594
|
return new Promise((resolve, reject) => {
|
|
593
595
|
let settled = false;
|
|
594
596
|
|
|
597
|
+
if(!command) {
|
|
598
|
+
reject(new Error("Command is required for request"));
|
|
599
|
+
return;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
if(!replyChannel) {
|
|
603
|
+
replyChannel = `${command}-reply-${this.id}`;
|
|
604
|
+
}
|
|
605
|
+
|
|
595
606
|
const unsubscribe = ipc.handle(replyChannel, (data) => {
|
|
596
607
|
if (!settled) {
|
|
597
608
|
settled = true;
|
|
@@ -601,15 +612,34 @@ async request(command, replyChannel, ...args) {
|
|
|
601
612
|
}
|
|
602
613
|
});
|
|
603
614
|
|
|
604
|
-
|
|
615
|
+
let timeout;
|
|
616
|
+
|
|
617
|
+
if(!args.includes("NO_TIMEOUT")) {
|
|
618
|
+
let timeoutDuration = 7000;
|
|
619
|
+
|
|
620
|
+
const timeoutArg = args.find(
|
|
621
|
+
arg => typeof arg === "string" && arg.startsWith("TIMEOUT=")
|
|
622
|
+
);
|
|
623
|
+
|
|
624
|
+
if (timeoutArg) {
|
|
625
|
+
|
|
626
|
+
args = args.filter(arg => arg !== timeoutArg);
|
|
627
|
+
|
|
628
|
+
timeoutDuration = parseInt(timeoutArg.split("=")[1], 10);
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
timeout = setTimeout(() => {
|
|
605
632
|
if (!settled) {
|
|
606
633
|
settled = true;
|
|
607
634
|
unsubscribe();
|
|
608
635
|
reject(new Error(`Request timed out waiting for reply on channel "${replyChannel}"`));
|
|
609
636
|
}
|
|
610
|
-
},
|
|
637
|
+
}, timeoutDuration);
|
|
638
|
+
} else {
|
|
639
|
+
args = args.filter(arg => arg !== "NO_TIMEOUT");
|
|
640
|
+
}
|
|
611
641
|
|
|
612
|
-
this.sendCommand(command, args);
|
|
642
|
+
this.sendCommand(command, [...args, replyChannel]);
|
|
613
643
|
});
|
|
614
644
|
}
|
|
615
645
|
|
package/package.json
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"name": "positron.js",
|
|
3
3
|
"description": "A lightweight cross-platform hybrid application framework designed to build desktop applications using a native compiled runtime driven by a Node.js main process.",
|
|
4
4
|
"repository": {
|
|
5
|
-
"url": "https://github.com/systemsoftware/positron
|
|
5
|
+
"url": "https://github.com/systemsoftware/positron.js"
|
|
6
6
|
},
|
|
7
7
|
"homepage": "https://positronjs.gitbook.io",
|
|
8
|
-
"version": "1.0.
|
|
8
|
+
"version": "1.0.1",
|
|
9
9
|
"main": "index.js",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"test": "node --test"
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@yao-pkg/pkg": "^6.20.0",
|
|
23
23
|
"esbuild": "^0.28.0",
|
|
24
|
-
"resedit": "^3.0.2",
|
|
25
24
|
"ws": "^8.20.1"
|
|
26
25
|
},
|
|
27
26
|
"bin": {
|