Calls Reference
ESDK exposes a set of native JavaScript bindings that let your frontend HTML control the OS window and communicate with the C++ and Python layers. All bindings are available globally on the window object and are injected before window.onload fires.
Window Control
windowClose()
returns: voidPosts WM_CLOSE to the native window handle, triggering the standard OS close flow (prompts the user if the app intercepts it). Equivalent to clicking the window's × button.
windowMinimize()
returns: voidMinimizes the app window to the taskbar. Has no effect if the window style does not include WS_MINIMIZEBOX (controlled by CAN_MINIMIZE in properties.config).
windowMaximize()
returns: voidToggles the window between maximized and restored states. If the window is currently maximized, calling this restores it to its previous size and position.
dragWindow()
returns: voidInitiates a native window drag. Bind it to onmousedown on any element you want to act as a drag handle (typically a custom titlebar region). The drag ends automatically when the mouse button is released.
Modal System
openModal(name)
returns: Promise<any>Opens ui/modals/<name>.html as a new native OS window on its own thread. The Promise resolves when the modal calls closeModal(value). If the modal file is not found, the Promise resolves with null.
| Parameter | Type | Description |
|---|---|---|
| name | string | Name of the modal file without the .html extension (e.g. "alert", "prompt"). |
closeModal(value)
modal-only · returns: voidCloses the current modal OS window and resolves the parent window's Promise with value. Only available inside a modal's <script> block — it is not a global binding in the main window.
| Parameter | Type | Description |
|---|---|---|
| value | any | The value forwarded to openModal().then(). Pass null to indicate cancellation. |
Backend Bridge
invokeBridge(payload)
returns: Promise<object>Sends a JSON payload through the C++ bridge to server/api.py's handle_message() function and returns the Python response as a parsed object. The action field is used by the server to route the request.
| Parameter | Type | Description |
|---|---|---|
| payload | object | A JS object with at minimum an action field. Additional fields are passed to the Python handler. |
Navigation & Links
openExternalLink(url)
returns: voidOpens a URL in the user's default system browser via ShellExecuteA. All <a href="https://..."> clicks in the webview are intercepted automatically and routed through this binding — you don't need to call it manually for standard links.
| Parameter | Type | Description |
|---|---|---|
| url | string | A fully-qualified http:// or https:// URL. |
Quick Reference
| Call | Available In | Returns | Notes |
|---|---|---|---|
windowClose() | Main window | void | Posts WM_CLOSE |
windowMinimize() | Main window | void | Requires CAN_MINIMIZE |
windowMaximize() | Main window | void | Toggles maximize/restore |
dragWindow() | Main window & modals | void | Bind to onmousedown |
openModal(name) | Main window | Promise<any> | Opens native OS window |
closeModal(value) | Modal windows only | void | Resolves parent Promise |
invokeBridge(payload) | Main window | Promise<object> | Calls server/api.py |
openExternalLink(url) | Main window | void | Auto-wired to <a href> |