Skip to content

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.
  • -Element always 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.RpcException with a Code.

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

Command Purpose
Open-NativeHTMLKitHtml, Open-NativeHTMLKitFile Load a document (replaces the current one).
Remove-NativeHTMLKitDocument Unload the document.
Get-NativeHTMLKitDocumentText, Set-NativeHTMLKitDocumentText Read / set text (never parsed as HTML).
Get-NativeHTMLKitValue, Set-NativeHTMLKitDocumentValue Control values.
Get-NativeHTMLKitChecked, Set-NativeHTMLKitChecked Checkboxes and radio buttons.
Set-NativeHTMLKitDocumentAttribute, Set-NativeHTMLKitClass Attributes and classes.
Set-NativeHTMLKitDocumentHtml, Remove-NativeHTMLKitElement Replace/insert trusted HTML, remove elements.
Find-NativeHTMLKitElement CSS selector query (ids and counts).
Invoke-NativeHTMLKitBatch Several DOM operations atomically.
Invoke-NativeHTMLKitDocumentCommand Any of the 81 Core document commands.
Add-NativeHTMLKitStylesheet, Get-NativeHTMLKitStylesheets, Set-NativeHTMLKitStylesheet Stylesheets.
Get-NativeHTMLKitComputedStyle Computed CSS values.
Get-NativeHTMLKitEnvironment, Set-NativeHTMLKitEnvironment Colour scheme and reduced-motion overrides.
Get-NativeHTMLKitScroll, Set-NativeHTMLKitScroll Scrolling.
Get-NativeHTMLKitFocusedElement, Set-NativeHTMLKitFocus Focus.
Get-NativeHTMLKitSelection, Set-NativeHTMLKitSelection, Invoke-NativeHTMLKitEditCommand Text selection and editing commands.
Register-NativeHTMLKitResources, Unregister-NativeHTMLKitResources In-memory images, icons, fonts (nativehtmlkit-res://).

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.