I think of bind as glue. You glue a parameter to a function and can call it without the parameter later.
Code: Select all
boundFunc := Func("StrLen").bind("a parameter")
msgbox, % boundFunc.call()
; => 11
; same as
msgbox, % StrLen("a parameter")
; => 11
Now
StrLen only takes one parameter; but bind can glue one or more parameters. So maybe you run into a situation where you know the first parameter is always the same, but the second parameter may be adjustable. you can bind that first parameter and supply the second as needed.
Code: Select all
boundFunc := Func("InStr").bind("Haystack")
msgbox, % boundFunc.call("0000") ; same as InStr("Haystack", "0000")
; => 0
msgbox, % boundFunc.call("Hay") ; same as InStr("Haystack", "Hay")
; => 1
In the code you posted; a timer is stared and calls the function with its parameter glues on. This is probably useful for scope since it doesn't have to have keep access to that parameter at the timer scope.