We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 399ffa2 commit 19d6da4Copy full SHA for 19d6da4
filter.go
@@ -4,21 +4,14 @@ import (
4
"github.com/gopherjs/gopherjs/js"
5
)
6
7
-type Filter struct {
8
- *js.Object
9
- Read interface{} `js:"read"`
10
- Write interface{} `js:"write"`
11
-}
+// Filter return interface{} to utilize GopherJS type convertion automatically
+type Filter func(oldValue *js.Object) (newValue interface{})
12
13
// using interface{} type here to utilize GopherJS type convertion automatically
14
-func NewFilter(readerfn interface{}) *Filter {
15
- f := &Filter{
16
- Object: js.Global.Get("Object").New(),
17
- }
18
- f.Read = readerfn
19
- return f
+func NewFilter(fn func(oldValue *js.Object) (newValue interface{})) Filter {
+ return Filter(fn)
20
}
21
22
-func (f *Filter) Register(name string) {
23
- vue.Call("filter", name, f.Object)
+func (f Filter) Register(name string) {
+ vue.Call("filter", name, f)
24
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments