-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
49 lines (34 loc) · 1.29 KB
/
main.go
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
37
38
39
40
41
42
43
44
45
46
47
48
49
package main
import (
"log"
"syscall/js"
sfom_placetypes "github.com/sfomuseum/go-sfomuseum-placetypes"
wof_wasm "github.com/whosonfirst/go-whosonfirst-placetypes-wasm"
)
func main() {
spec, err := sfom_placetypes.SFOMuseumPlacetypeSpecification()
if err != nil {
log.Fatalf("Failed to load SFO Museum placetypes specification, %w", err)
}
descendants_func := wof_wasm.DescendantsFunc(spec)
defer descendants_func.Release()
ancestors_func := wof_wasm.AncestorsFunc(spec)
defer ancestors_func.Release()
placetypes_func := wof_wasm.PlacetypesFunc(spec)
defer placetypes_func.Release()
parents_func := wof_wasm.ParentsFunc(spec)
defer parents_func.Release()
children_func := wof_wasm.ChildrenFunc(spec)
defer children_func.Release()
isvalid_func := wof_wasm.IsValidFunc(spec)
defer isvalid_func.Release()
js.Global().Set("sfomuseum_placetypes_descendants", descendants_func)
js.Global().Set("sfomuseum_placetypes_ancestors", ancestors_func)
js.Global().Set("sfomuseum_placetypes_children", children_func)
js.Global().Set("sfomuseum_placetypes_parents", parents_func)
js.Global().Set("sfomuseum_placetypes_is_valid", isvalid_func)
js.Global().Set("sfomuseum_placetypes", placetypes_func)
c := make(chan struct{}, 0)
log.Println("SFO Museum placetypes WASM binary initialized")
<-c
}