Clean up some global wrappers
This commit is contained in:
parent
73c21e0df4
commit
e9b1a89052
1 changed files with 6 additions and 1 deletions
|
@ -48,6 +48,8 @@ var isa = func(obj, class) {
|
||||||
#
|
#
|
||||||
var fgcommand = func(cmd, node=nil) {
|
var fgcommand = func(cmd, node=nil) {
|
||||||
if(isa(node, props.Node)) node = node._g;
|
if(isa(node, props.Node)) node = node._g;
|
||||||
|
elsif(typeof(node) == 'hash')
|
||||||
|
node = props.Node.new(node)._g;
|
||||||
_fgcommand(cmd, node);
|
_fgcommand(cmd, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +87,8 @@ var abs = func(v) { return v < 0 ? -v : v }
|
||||||
#
|
#
|
||||||
var interpolate = func(node, val...) {
|
var interpolate = func(node, val...) {
|
||||||
if(isa(node, props.Node)) node = node._g;
|
if(isa(node, props.Node)) node = node._g;
|
||||||
elsif(typeof(node) != "scalar") return;
|
elsif(typeof(node) != "scalar" and typeof(node) != "ghost")
|
||||||
|
die("bad argument to interpolate()");
|
||||||
_interpolate(node, val);
|
_interpolate(node, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,6 +104,8 @@ var interpolate = func(node, val...) {
|
||||||
#
|
#
|
||||||
var setlistener = func(node, fn, init = 0, runtime = 1) {
|
var setlistener = func(node, fn, init = 0, runtime = 1) {
|
||||||
if(isa(node, props.Node)) node = node._g;
|
if(isa(node, props.Node)) node = node._g;
|
||||||
|
elsif(typeof(node) != "scalar" and typeof(node) != "ghost")
|
||||||
|
die("bad argument to setlistener()");
|
||||||
var id = _setlistener(node, func(chg, lst, mode, is_child) {
|
var id = _setlistener(node, func(chg, lst, mode, is_child) {
|
||||||
fn(props.wrapNode(chg), props.wrapNode(lst), mode, is_child);
|
fn(props.wrapNode(chg), props.wrapNode(lst), mode, is_child);
|
||||||
}, init, runtime);
|
}, init, runtime);
|
||||||
|
|
Loading…
Reference in a new issue