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 7dd2d36

Browse files
committed
using interface{} for Directive callbacks
1 parent 3684a4d commit 7dd2d36

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

‎directive.go‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,28 +61,28 @@ type Directive struct {
6161
// Priority int `js:"priority"`
6262
}
6363

64-
func NewDirective(updater ...func(el*js.Object, b*DirectiveBinding, val*js.Object)) *Directive {
64+
func NewDirective(updaterCallBack ...interface{}) *Directive {
6565
d := &Directive{
6666
Object: js.Global.Get("Object").New(),
6767
}
68-
if len(updater) > 0 {
69-
d.SetUpdater(updater[0])
68+
if len(updaterCallBack) > 0 {
69+
d.SetUpdater(updaterCallBack[0])
7070
}
7171
return d
7272
}
7373

74-
func (d *Directive) SetBinder(fnfunc(b*DirectiveBinding)) *Directive {
75-
d.Set("bind", fn)
74+
func (d *Directive) SetBinder(fnCallbackinterface{}) *Directive {
75+
d.Set("bind", fnCallback)
7676
return d
7777
}
7878

79-
func (d *Directive) SetUnBinder(fnfunc(b*DirectiveBinding)) *Directive {
80-
d.Set("unbind", fn)
79+
func (d *Directive) SetUnBinder(fnCallbackinterface{}) *Directive {
80+
d.Set("unbind", fnCallback)
8181
return d
8282
}
8383

84-
func (d *Directive) SetUpdater(fnfunc(el*js.Object, b*DirectiveBinding, val*js.Object)) *Directive {
85-
d.Set("update", fn)
84+
func (d *Directive) SetUpdater(fnCallbackinterface{}) *Directive {
85+
d.Set("update", fnCallback)
8686
return d
8787
}
8888

@@ -109,12 +109,12 @@ type ElementDirective struct {
109109
*Directive
110110
}
111111

112-
func NewElementDirective(updater ...func(el*js.Object, b*DirectiveBinding, val*js.Object)) *ElementDirective {
112+
func NewElementDirective(updaterCallBack ...interface{}) *ElementDirective {
113113
d := &ElementDirective{
114-
Directive: NewDirective(updater...),
114+
Directive: NewDirective(updaterCallBack...),
115115
}
116-
if len(updater) > 0 {
117-
d.SetUpdater(updater[0])
116+
if len(updaterCallBack) > 0 {
117+
d.SetUpdater(updaterCallBack[0])
118118
}
119119
return d
120120
}

0 commit comments

Comments
(0)

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