WASM reactive UI framework for Go: - reactive/ - Signal[T], Effect, Runtime - ui/ - Button, Text, Input, View, Canvas, SVG components - navigation/ - Router, guards, history management - auth/ - OIDC client for WASM applications - host/ - Static file server Extracted from arcadia as open-source component. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
18
reactive/effect.go
Normal file
18
reactive/effect.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package reactive
|
||||
|
||||
type EffectId int
|
||||
|
||||
func NewEffect(f func()) {
|
||||
rt := GetRuntime()
|
||||
effectId := EffectId(len(rt.effects))
|
||||
rt.effects = append(rt.effects, f)
|
||||
|
||||
runEffect(rt, effectId)
|
||||
}
|
||||
|
||||
func NewEffectWithRuntime(rt *Runtime, f func()) {
|
||||
effectId := EffectId(len(rt.effects))
|
||||
rt.effects = append(rt.effects, f)
|
||||
|
||||
runEffect(rt, effectId)
|
||||
}
|
||||
Reference in New Issue
Block a user