QML API (escape hatch)
QML is optional. Advanced users can set "ui": "ui/main.qml" on a window and
use the full QML API below; the same Store and capabilities are available.
import Pulsar 1.0 // Pulsar singleton + Store
Pulsar
| Method | Description |
|---|---|
Pulsar.emit(name, params) |
Fire an event to the app (app.on(name, ...)). |
Pulsar.call(name, params) |
Invoke an event/capability; returns a Promise (e.g. Pulsar.call("fs.exists", { path: "." }).then(...)). |
Pulsar.openFile(title, filter, dir) |
Native open dialog; returns the path (synchronous). |
Pulsar.saveFile(title, filter, dir) |
Native save dialog; returns the path. |
Pulsar.message(title, text) |
Native message box. |
Pulsar.clipboardText() / Pulsar.clipboardWrite(text) |
Clipboard. |
Pulsar.trayAvailable() |
Whether a system tray is available. |
Pulsar.setTrayIcon(path) / Pulsar.setTrayTooltip(text) / Pulsar.setTrayMenu(items) / Pulsar.hideTray() |
Tray control. |
Pulsar.diagnostics() |
Debug string. |
Pulsar.restart() |
Restart the backend (dev). |
Pulsar.colorScheme |
"light" / "dark" (reactive; colorSchemeChanged). |
Signals: log(level, message, source), appEvent(event, payload, target) and
colorSchemeChanged — subscribe with Connections. Each window also gets a
PulsarWindowLabel context property with its own label.
Store
Store.<key> mirrors every app.store value reactively:
Label { text: "Count: " + (Store.count ?? 0) }
Grid { model: Store.photos; delegate: Image { required property var modelData; source: modelData.url } }
Multi-window
// main.ts
app.on("togglePanel", async () => {
const open = app.store.get("panelOpen") as boolean
const panel = app.window("panel")
await (open ? panel.hide() : panel.show())
app.store.set("panelOpen", !open)
})
// panel.qml
Button {
text: "Close me"
onClicked: Pulsar.call("window", { label: "panel", action: "close" })
}