|
|
@ -92,11 +92,11 @@ Fix.watch = function(model, expOrFn, cb, options) { |
|
|
|
function() { |
|
|
|
function() { |
|
|
|
options && options.store && pushTarget(options.store); |
|
|
|
options && options.store && pushTarget(options.store); |
|
|
|
let res; |
|
|
|
let res; |
|
|
|
try { |
|
|
|
// try {
|
|
|
|
res = cb.apply(this, arguments); |
|
|
|
res = cb.apply(this, arguments); |
|
|
|
} catch (e) { |
|
|
|
// } catch (e) {
|
|
|
|
console.error(e); |
|
|
|
// console.error(e);
|
|
|
|
} |
|
|
|
// }
|
|
|
|
options && options.store && popTarget(); |
|
|
|
options && options.store && popTarget(); |
|
|
|
|
|
|
|
|
|
|
|
return res; |
|
|
|
return res; |
|
|
@ -169,11 +169,11 @@ export function createStore() { |
|
|
|
const _init = Widget.prototype._init; |
|
|
|
const _init = Widget.prototype._init; |
|
|
|
Widget.prototype._init = function() { |
|
|
|
Widget.prototype._init = function() { |
|
|
|
const needPop = createStore.call(this); |
|
|
|
const needPop = createStore.call(this); |
|
|
|
try { |
|
|
|
// try {
|
|
|
|
_init.apply(this, arguments); |
|
|
|
_init.apply(this, arguments); |
|
|
|
} catch (e) { |
|
|
|
// } catch (e) {
|
|
|
|
console.error(e); |
|
|
|
// console.error(e);
|
|
|
|
} |
|
|
|
// }
|
|
|
|
needPop && popTarget(); |
|
|
|
needPop && popTarget(); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
@ -192,11 +192,11 @@ Widget.prototype.__initWatch = function() { |
|
|
|
|
|
|
|
|
|
|
|
const unMount = Widget.prototype.__destroy; |
|
|
|
const unMount = Widget.prototype.__destroy; |
|
|
|
Widget.prototype.__destroy = function() { |
|
|
|
Widget.prototype.__destroy = function() { |
|
|
|
try { |
|
|
|
// try {
|
|
|
|
unMount.apply(this, arguments); |
|
|
|
unMount.apply(this, arguments); |
|
|
|
} catch (e) { |
|
|
|
// } catch (e) {
|
|
|
|
console.error(e); |
|
|
|
// console.error(e);
|
|
|
|
} |
|
|
|
// }
|
|
|
|
this.store && isFunction(this.store.destroy) && this.store.destroy(); |
|
|
|
this.store && isFunction(this.store.destroy) && this.store.destroy(); |
|
|
|
each(this._watchers, (i, unwatches) => { |
|
|
|
each(this._watchers, (i, unwatches) => { |
|
|
|
unwatches = isArray(unwatches) ? unwatches : [unwatches]; |
|
|
|
unwatches = isArray(unwatches) ? unwatches : [unwatches]; |
|
|
@ -238,11 +238,11 @@ _.each(["_render", "__afterRender", "_mount", "__afterMount"], (name) => { |
|
|
|
(Widget.prototype[name] = function() { |
|
|
|
(Widget.prototype[name] = function() { |
|
|
|
this.store && pushTarget(this.store); |
|
|
|
this.store && pushTarget(this.store); |
|
|
|
let res; |
|
|
|
let res; |
|
|
|
try { |
|
|
|
// try {
|
|
|
|
res = old.apply(this, arguments); |
|
|
|
res = old.apply(this, arguments); |
|
|
|
} catch (e) { |
|
|
|
// } catch (e) {
|
|
|
|
console.error(e); |
|
|
|
// console.error(e);
|
|
|
|
} |
|
|
|
// }
|
|
|
|
this.store && popTarget(); |
|
|
|
this.store && popTarget(); |
|
|
|
|
|
|
|
|
|
|
|
return res; |
|
|
|
return res; |
|
|
|