Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a6bdef9

Browse files
committed
using interface{} in Filter to utilize GopherJS type convertion automatically
1 parent c01ba7c commit a6bdef9

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

‎filter.go‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,14 @@ type Filter struct {
88
*js.Object
99
Read interface{} `js:"read"`
1010
Write interface{} `js:"write"`
11-
// Read func(vm *ViewModel, args []*js.Object) *js.Object `js:"read"`
12-
// Write func(vm *ViewModel, args []*js.Object) *js.Object `js:"write"`
1311
}
1412

15-
func NewFilter(read func(val *js.Object) *js.Object) *Filter {
13+
// using interface{} type here to utilize GopherJS type convertion automatically
14+
func NewFilter(readerfn interface{}) *Filter {
1615
f := &Filter{
1716
Object: js.Global.Get("Object").New(),
1817
}
19-
f.Read = read
18+
f.Read = readerfn
2019
return f
2120
}
2221

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /