|
|
@ -13,7 +13,7 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function createWatcher(vm, keyOrFn, cb, options) { |
|
|
|
function createWatcher (vm, keyOrFn, cb, options) { |
|
|
|
if (BI.isPlainObject(cb)) { |
|
|
|
if (BI.isPlainObject(cb)) { |
|
|
|
options = cb; |
|
|
|
options = cb; |
|
|
|
cb = cb.handler; |
|
|
|
cb = cb.handler; |
|
|
@ -110,6 +110,26 @@ |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BI.watch = function (watch, handler) { |
|
|
|
|
|
|
|
if (BI.Widget.current) { |
|
|
|
|
|
|
|
if (BI.isKey(watch)) { |
|
|
|
|
|
|
|
var key = watch; |
|
|
|
|
|
|
|
watch = {}; |
|
|
|
|
|
|
|
watch[key] = handler; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for (var key in watch) { |
|
|
|
|
|
|
|
var handler = watch[key]; |
|
|
|
|
|
|
|
if (BI.isArray(handler)) { |
|
|
|
|
|
|
|
for (var i = 0; i < handler.length; i++) { |
|
|
|
|
|
|
|
BI.Widget.current._watchers.push(createWatcher(BI.Widget.current, key, handler[i])); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
BI.Widget.current._watchers.push(createWatcher(BI.Widget.current, key, handler)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
_.each(["populate", "addItems", "prependItems"], function (name) { |
|
|
|
_.each(["populate", "addItems", "prependItems"], function (name) { |
|
|
|
var old = BI.Loader.prototype[name]; |
|
|
|
var old = BI.Loader.prototype[name]; |
|
|
|
BI.Loader.prototype[name] = function () { |
|
|
|
BI.Loader.prototype[name] = function () { |
|
|
@ -280,5 +300,4 @@ |
|
|
|
return Fix.toJSON(ob); |
|
|
|
return Fix.toJSON(ob); |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
BI.watch = Fix.watch; |
|
|
|
|
|
|
|
}()); |
|
|
|
}()); |
|
|
|