-
Notifications
You must be signed in to change notification settings - Fork 4
/
notjs.go
31 lines (27 loc) · 909 Bytes
/
notjs.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
//go:build !js && !wasm
// +build !js,!wasm
package main
import (
"github.com/aperturerobotics/controllerbus/bus"
"github.com/aperturerobotics/controllerbus/controller/resolver"
"github.com/aperturerobotics/controllerbus/controller/resolver/static"
"github.com/aperturerobotics/controllerbus/directive"
hot_loader_filesystem "github.com/aperturerobotics/controllerbus/plugin/loader/shared-library/filesystem"
"github.com/pkg/errors"
)
// addHotLoader adds the hot loader to the bus.
// no-op on js
func addHotLoader(b bus.Bus, sr *static.Resolver) (directive.Reference, error) {
sr.AddFactory(hot_loader_filesystem.NewFactory(b))
_, hlRef, err := b.AddDirective(
resolver.NewLoadControllerWithConfig(&hot_loader_filesystem.Config{
Dir: pluginDir,
Watch: true,
}),
nil,
)
if err != nil {
return nil, errors.Wrap(err, "construct plugin loading controller")
}
return hlRef, nil
}