-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrun_stub.go
More file actions
36 lines (32 loc) · 1.28 KB
/
run_stub.go
File metadata and controls
36 lines (32 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//go:build !js && !dev
// +build !js,!dev
package thunder
import "github.com/octoberswimmer/masc"
// Run initializes a Thunder application for deployment in Salesforce Lightning.
//
// In production builds (GOOS=js GOARCH=wasm), this function registers the global
// "startWithDiv" JavaScript function that Lightning Web Components call to launch
// the Go WASM application within a specific DOM element.
//
// In development builds (GOOS=js GOARCH=wasm -tags dev), this function directly
// renders the application into the "app" div element provided by thunder serve.
//
// The model parameter should implement masc.Model with Init(), Update(), and Render()
// methods following the Elm Architecture pattern.
//
// This function will panic if called outside a WebAssembly environment, as Thunder
// applications are designed to run only in the browser via Lightning Web Components.
//
// Example usage:
//
// func main() {
// thunder.Run(&MyAppModel{})
// }
func Run(model masc.Model) {
panic("thunder.Run is not supported outside the WASM environment")
}
// GetCurrentDiv returns the current div element for the Thunder instance
// This is a stub function for non-WASM environments
func GetCurrentDiv() interface{} {
panic("thunder.GetCurrentDiv is not supported outside the WASM environment")
}