NativeHTMLKit PowerShell SDK: cmdlet reference¶
Module NativeHTMLKit 0.1.2, bundling NativeHTMLKit Core 1.0.3 (public wire protocol v1).
PowerShell 7.2+ on Linux and Windows, Windows PowerShell 5.1 on Windows.
This page is the entry point of the reference: every exported command, grouped by task, with a link
to its full description (syntax, parameters with types and defaults, output, errors, examples).
88 functions are exported, each with one short -NHK alias (alias table).
Run Get-Command -Module NativeHTMLKit and Get-Help <command> for the installed copy.
New here? Start with getting started, the tutorials (todo app, process dashboard, bulk rename) or the examples. Concepts: architecture.
Conventions¶
- Handles (
NativeHTMLKit.Application,.Window,.Document,.Node, ...) belong to the runspace that created the application. Callbacks run on that runspace while it pumps events. Objects, errors, threading and limits. - Parameter tables name the expected handle type (
NativeHTMLKit.Document, ...). Those parameters are declared as[object](see the syntax blocks) and checked when the command runs; passing the wrong handle throws, for example,Expected a NativeHTMLKit.Window from New-NativeHTMLKitWindow. -Elementalways means an element id. Elements without ids are reached through nodes.- Text you show is safe with
Set-NativeHTMLKitDocumentText; HTML you build must encode untrusted values. Security guide. - Failures are terminating errors; host refusals are
NativeHTMLKit.RpcExceptionwith aCode.
Application lifecycle - reference/lifecycle.md¶
| Command | Purpose |
|---|---|
Start-NativeHTMLKitScript |
Run a .ps1 as an app: start the host, relaunch the script as backend, return the application. |
Connect-NativeHTMLKit |
Connect a backend started from an app.toml manifest. |
Set-NativeHTMLKitReady |
Tell the host startup finished. |
Wait-NativeHTMLKit |
Pump events and run callbacks (-UntilShutdown, or a timed pump). |
Request-NativeHTMLKitQuit |
Ask for an orderly quit. |
Set-NativeHTMLKitBeforeQuit |
Quit policy (veto with $false). |
Register-NativeHTMLKitNotification |
Callback for host notifications such as window.event. |
Close-NativeHTMLKit |
Close the connection and retire all handles. |
Start-NativeHTMLKitHost |
Run an app.toml manifest through the host. |
Get-NativeHTMLKitHostPath |
Path of the (verified) host binary. |
Windows - reference/windows.md¶
| Command | Purpose |
|---|---|
New-NativeHTMLKitWindow |
Create a window. |
Set-NativeHTMLKitWindow |
Title, size, state, constraints. |
Get-NativeHTMLKitWindow |
The host's description of a window. |
Get-NativeHTMLKitWindowList |
All open windows (one array object). |
Close-NativeHTMLKitWindow |
Graceful close (policy may veto). |
Set-NativeHTMLKitBeforeClose |
Close policy per window. |
Request-NativeHTMLKitAttention |
Flag the window on the desktop. |
Documents and DOM - reference/documents.md¶
Events - reference/events.md¶
| Command | Purpose |
|---|---|
Register-NativeHTMLKitDocumentEvent |
Run a scriptblock for DOM events (with delegation by id). |
Unregister-NativeHTMLKitDocumentEvent |
Remove a subscription. |
Set-NativeHTMLKitPreventDefault |
Cancel a native default action (registered in advance). |
The event object fields and when callbacks run are described there.
Forms, dialogs and popovers - reference/forms.md¶
| Command | Purpose |
|---|---|
Get-NativeHTMLKitFormData |
Form entries in submission order. |
Submit-NativeHTMLKitForm, Reset-NativeHTMLKitForm |
Submit (with native validation) or reset. |
Get-NativeHTMLKitSelectOptions, Set-NativeHTMLKitSelectedValues |
<select> options. |
Show-NativeHTMLKitHtmlDialog |
Open/close an HTML <dialog>. |
Show-NativeHTMLKitPopover |
Show/hide/toggle a popover element. |
Nodes - reference/nodes.md¶
Get-NativeHTMLKitNode,
Get-NativeHTMLKitNodes,
Get-NativeHTMLKitNodeInfo,
Get-NativeHTMLKitNodeChildren,
Invoke-NativeHTMLKitNodeOperation,
Invoke-NativeHTMLKitNodeBatch: address and
change elements that have no id.
Desktop services - reference/desktop.md¶
| Command | Purpose |
|---|---|
Get-NativeHTMLKitCapabilities |
What this host and session offer. |
Get-NativeHTMLKitPreferences |
Observed colour scheme, contrast, motion. |
Get-NativeHTMLKitClipboard, Set-NativeHTMLKitClipboard |
Plain-text clipboard. |
Open-NativeHTMLKitExternal |
Open a URL/document, or reveal a file. |
Show-NativeHTMLKitFileDialog |
Native Open / Save / Choose-folder dialogs. |
Live bitmaps - reference/bitmaps.md¶
New-NativeHTMLKitLiveBitmap,
Send-NativeHTMLKitLiveBitmap,
Remove-NativeHTMLKitLiveBitmap: RGBA
pixels you compute, shown by <img src="nativehtmlkit-bitmap://ID">.
Background tasks - reference/tasks.md¶
Start-NativeHTMLKitTask,
Receive-NativeHTMLKitTask,
Stop-NativeHTMLKitTask: work in isolated runspaces
with completion callbacks on the UI runspace.
Diagnostics - reference/diagnostics.md¶
| Command | Purpose |
|---|---|
Get-NativeHTMLKitDiagnosticReport |
SDK, connection and host loss counters. |
Export-NativeHTMLKitSupportBundle |
Local, redacted ZIP for bug reports. |
Get-NativeHTMLKitDiagnostics |
Document CSS/resource notes. |
Get-NativeHTMLKitResourceStats, Clear-NativeHTMLKitUnusedResources |
Resource cache. |
Raw protocol access - reference/rpc.md¶
Invoke-NativeHTMLKitRpc,
Start-NativeHTMLKitRpc,
Wait-NativeHTMLKitRpc,
Stop-NativeHTMLKitRpc,
Send-NativeHTMLKitNotification.
Tooling - reference/tooling.md¶
New-NativeHTMLKitProject (app scaffold) and
Install-NativeHTMLKitSkill (coding-agent skill).
Guides¶
All guides: Lifecycle · Events and callbacks · Updating the page · Forms and validation · Windows · File dialogs · Dialogs and popovers · Clipboard and desktop · Keyboard and focus · Styling and layout · Live bitmaps · Background work · Diagnostics and troubleshooting · Packaging and distribution · Project scaffolding · Security · Windows PowerShell 5.1 and PowerShell 7
Source: nativehtmlkit-powershell/docs/API.md · edit the page there.