|
|
@ -36,18 +36,6 @@ |
|
|
|
Fix.Model.target = target = targetStack.pop(); |
|
|
|
Fix.Model.target = target = targetStack.pop(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var context = null; |
|
|
|
|
|
|
|
var contextStack = []; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function pushContext (_context) { |
|
|
|
|
|
|
|
if (context) contextStack.push(context); |
|
|
|
|
|
|
|
Fix.Model.context = context = _context; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function popContext () { |
|
|
|
|
|
|
|
Fix.Model.context = context = contextStack.pop(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var oldWatch = Fix.watch; |
|
|
|
var oldWatch = Fix.watch; |
|
|
|
Fix.watch = function (model, expOrFn, cb, options) { |
|
|
|
Fix.watch = function (model, expOrFn, cb, options) { |
|
|
|
if (BI.isPlainObject(cb)) { |
|
|
|
if (BI.isPlainObject(cb)) { |
|
|
@ -90,25 +78,25 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var _create = BI.createWidget; |
|
|
|
// var _create = BI.createWidget;
|
|
|
|
BI.createWidget = function (item, options, context) { |
|
|
|
// BI.createWidget = function (item, options, context) {
|
|
|
|
var pushed = false; |
|
|
|
// var pushed = false;
|
|
|
|
if (BI.isWidget(options)) { |
|
|
|
// if (BI.isWidget(options)) {
|
|
|
|
pushContext(options); |
|
|
|
// pushContext(options);
|
|
|
|
pushed = true; |
|
|
|
// pushed = true;
|
|
|
|
} else if (context != null) { |
|
|
|
// } else if (context != null) {
|
|
|
|
pushContext(context); |
|
|
|
// pushContext(context);
|
|
|
|
pushed = true; |
|
|
|
// pushed = true;
|
|
|
|
} |
|
|
|
// }
|
|
|
|
var result = _create.apply(this, arguments); |
|
|
|
// var result = _create.apply(this, arguments);
|
|
|
|
// try {
|
|
|
|
// // try {
|
|
|
|
// var result = _create.apply(this, arguments);
|
|
|
|
// // var result = _create.apply(this, arguments);
|
|
|
|
// } catch (e) {
|
|
|
|
// // } catch (e) {
|
|
|
|
// console.error(e);
|
|
|
|
// // console.error(e);
|
|
|
|
// }
|
|
|
|
// // }
|
|
|
|
pushed && popContext(); |
|
|
|
// pushed && popContext();
|
|
|
|
return result; |
|
|
|
// return result;
|
|
|
|
}; |
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
|
|
BI.watch = function (watch, handler) { |
|
|
|
BI.watch = function (watch, handler) { |
|
|
|
if (BI.Widget.current) { |
|
|
|
if (BI.Widget.current) { |
|
|
@ -133,13 +121,13 @@ |
|
|
|
_.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 () { |
|
|
|
pushContext(this); |
|
|
|
BI.Widget.pushContext(this); |
|
|
|
try { |
|
|
|
try { |
|
|
|
var result = old.apply(this, arguments); |
|
|
|
var result = old.apply(this, arguments); |
|
|
|
} catch (e) { |
|
|
|
} catch (e) { |
|
|
|
console.error(e); |
|
|
|
console.error(e); |
|
|
|
} |
|
|
|
} |
|
|
|
popContext(); |
|
|
|
BI.Widget.popContext(); |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
}; |
|
|
|
}; |
|
|
|
}); |
|
|
|
}); |
|
|
|