QORMQORM v0.8.4 api Get started

Go package: qormext

Auto-generated from github.com/qorm/qorm/pkg/qormext (TestAPIRef) — do not edit by hand.

The one public Go package. An app registers its own native ops (in Go) so the packager compiles them into the app's single executable — the desktop bridge dispatches unknown ops here.

import "github.com/qorm/qorm/pkg/qormext"

Package qormext is the user middle-layer registry. An app registers its OWN native ops (in Go) via native/desktop.go, which the packager compiles INTO the app's single executable. The desktop bridge dispatches unknown ops here.

Contract — the app's native/desktop.go:

package main
import "github.com/qorm/qorm/pkg/qormext"
func init() {
    qormext.Register("myOp", func(data map[string]any) string {
        // your Go logic; return one line of JS to run back in the app
        return `qormOnMyOp("done")`
    })
}

Functions

CallJS

func CallJS(script string)

CallJS runs a line of JS in the app's WebView (from the Go middle-layer).

CompatibleABI

func CompatibleABI(declared string) bool

CompatibleABI reports whether an app's declared plugin ABI (e.g. "1" or "1.2") is major-compatible with this runtime's ABIVersion. An empty/unset declaration is always compatible (the app uses no versioned middle-layer).

Emit

func Emit(event, dataJSON string)

Emit pushes a signal onto the frontend event channel: every qormOn(event) listener in the UI fires with dataJSON (a JSON value — "null" if empty). This is the middle-layer's push side: Go/WASM code tells the UI something changed and the frontend just listens, instead of the UI polling. Runs on desktop (via the evaluator) and in WASM (via eval) alike.

Native

func Native(op, dataJSON string)

Native triggers a framework low-level op (hardware bridge / built-in) directly from Go: e.g. Native("bluetoothScan", "{}") reaches the native bridge or Web API. Results arrive at the app's qormOn<X> JS callback.

Register

func Register(name string, fn Op)

Register adds a custom native op (call from an init() in native/desktop.go).

SetEvaluator

func SetEvaluator(fn func(string))

SetEvaluator wires the host's JS evaluator (desktop only).

Types

Op

type Op func(data map[string]any) string

Op handles a custom native op: it receives the qormToNative payload and returns a line of JS (e.g. qormOnFoo(...)) to eval back in the app, or "".