Browse Source

Merge remote-tracking branch 'remotes/origin/BI4.1'

# Conflicts:
#	dist/bundle.min.js
master
guy 7 years ago
parent
commit
48c7a336ff
  1. 27
      dist/fix/fix.compact.js

27
dist/fix/fix.compact.js vendored

@ -13,8 +13,10 @@
} }
} }
function createWatcher(vm, keyOrFn, handler, options) { function createWatcher(vm, keyOrFn, handler) {
return Fix.watch(vm.model, keyOrFn, _.bind(handler, vm), options) return Fix.watch(vm.model, keyOrFn, _.bind(handler, vm), {
store: vm
})
} }
var target = null var target = null
@ -29,6 +31,23 @@
Fix.Model.target = target = targetStack.pop() Fix.Model.target = target = targetStack.pop()
} }
var oldWatch = Fix.watch;
Fix.watch = function (model, expOrFn, cb, options) {
if (BI.isPlainObject(cb)) {
options = cb
cb = cb.handler
}
if (typeof cb === 'string') {
cb = model[cb]
}
return oldWatch.call(this, model, expOrFn, function () {
pushTarget(options.store);
var res = cb.apply(this, arguments);
popTarget();
return res;
}, options);
}
var _init = BI.Widget.prototype._init; var _init = BI.Widget.prototype._init;
BI.Widget.prototype._init = function () { BI.Widget.prototype._init = function () {
var needPop = false; var needPop = false;
@ -91,9 +110,9 @@
BI[name] = function (obj, fn) { BI[name] = function (obj, fn) {
return typeof fn === "function" ? old(obj, function (key, value) { return typeof fn === "function" ? old(obj, function (key, value) {
if (!(key in Fix.$$skipArray)) { if (!(key in Fix.$$skipArray)) {
return fn.apply(null, arguments); return fn.apply(this, arguments);
} }
}) : old.apply(null, arguments); }) : old.apply(this, arguments);
} }
}); });
}()); }());
Loading…
Cancel
Save