support optional setlistener() arg to fire callback function initially;
copy arg checking from interpolate()
This commit is contained in:
parent
dbc4f2bcb4
commit
714504b548
1 changed files with 5 additions and 2 deletions
|
@ -66,10 +66,13 @@ interpolate = func {
|
||||||
##
|
##
|
||||||
# Convenience wrapper for the _setlistener function. Takes a
|
# Convenience wrapper for the _setlistener function. Takes a
|
||||||
# single string or props.Node object in arg[0] indicating the
|
# single string or props.Node object in arg[0] indicating the
|
||||||
# listened to property, and a function in arg[1].
|
# listened to property, a function in arg[1], and an optional
|
||||||
|
# bool in arg[2], which triggers the function initially if true.
|
||||||
#
|
#
|
||||||
setlistener = func {
|
setlistener = func {
|
||||||
_setlistener(isa(arg[0], props.Node) ? arg[0]._g : arg[0], arg[1]);
|
if(isa(arg[0], props.Node)) { arg[0] = arg[0]._g; }
|
||||||
|
elsif(typeof(arg[0]) != "scalar") { return; }
|
||||||
|
_setlistener(arg[0], arg[1], size(arg) > 2 ? arg[2] : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue