@wailsio/runtime 3.0.0-alpha.78 → 3.0.0-alpha.79
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/dist/index.js +20 -0
- package/package.json +1 -1
- package/types/index.d.ts +6 -0
package/dist/index.js
CHANGED
|
@@ -35,8 +35,10 @@ export { Create };
|
|
|
35
35
|
export * from "./cancellable.js";
|
|
36
36
|
// Export transport interfaces and utilities
|
|
37
37
|
export { setTransport, getTransport, objectNames, clientId, } from "./runtime.js";
|
|
38
|
+
import { clientId } from "./runtime.js";
|
|
38
39
|
// Notify backend
|
|
39
40
|
window._wails.invoke = System.invoke;
|
|
41
|
+
window._wails.clientId = clientId;
|
|
40
42
|
// Register platform handlers (internal API)
|
|
41
43
|
// Note: Window is the thisWindow instance (default export from window.ts)
|
|
42
44
|
// Binding ensures 'this' correctly refers to the current window instance
|
|
@@ -46,3 +48,21 @@ window._wails.handleDragEnter = handleDragEnter;
|
|
|
46
48
|
window._wails.handleDragLeave = handleDragLeave;
|
|
47
49
|
window._wails.handleDragOver = handleDragOver;
|
|
48
50
|
System.invoke("wails:runtime:ready");
|
|
51
|
+
/**
|
|
52
|
+
* Loads a script from the given URL if it exists.
|
|
53
|
+
* Uses HEAD request to check existence, then injects a script tag.
|
|
54
|
+
* Silently ignores if the script doesn't exist.
|
|
55
|
+
*/
|
|
56
|
+
export function loadOptionalScript(url) {
|
|
57
|
+
return fetch(url, { method: 'HEAD' })
|
|
58
|
+
.then(response => {
|
|
59
|
+
if (response.ok) {
|
|
60
|
+
const script = document.createElement('script');
|
|
61
|
+
script.src = url;
|
|
62
|
+
document.head.appendChild(script);
|
|
63
|
+
}
|
|
64
|
+
})
|
|
65
|
+
.catch(() => { }); // Silently ignore - script is optional
|
|
66
|
+
}
|
|
67
|
+
// Load custom.js if available (used by server mode for WebSocket events, etc.)
|
|
68
|
+
loadOptionalScript('/wails/custom.js');
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -22,3 +22,9 @@ export { Application, Browser, Call, Clipboard, Dialogs, Events, Flags, Screens,
|
|
|
22
22
|
export { Create };
|
|
23
23
|
export * from "./cancellable.js";
|
|
24
24
|
export { setTransport, getTransport, type RuntimeTransport, objectNames, clientId, } from "./runtime.js";
|
|
25
|
+
/**
|
|
26
|
+
* Loads a script from the given URL if it exists.
|
|
27
|
+
* Uses HEAD request to check existence, then injects a script tag.
|
|
28
|
+
* Silently ignores if the script doesn't exist.
|
|
29
|
+
*/
|
|
30
|
+
export declare function loadOptionalScript(url: string): Promise<void>;
|