guy 7 years ago
parent
commit
eb5109faf0
  1. 82
      dist/_fineui.min.js
  2. 56
      dist/bundle.js
  3. 82
      dist/bundle.min.js
  4. 82
      dist/fineui.min.js
  5. 56
      dist/fix/fix.js

82
dist/_fineui.min.js vendored

File diff suppressed because one or more lines are too long

56
dist/bundle.js vendored

@ -34086,11 +34086,11 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
} }
}; };
Dep.prototype.notify = function notify() { Dep.prototype.notify = function notify(options) {
// stabilize the subscriber list first // stabilize the subscriber list first
var subs = this.subs.slice(); var subs = this.subs.slice();
for (var i = 0, l = subs.length; i < l; i++) { for (var i = 0, l = subs.length; i < l; i++) {
subs[i].update(); subs[i].update(options);
} }
}; };
@ -34354,11 +34354,11 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
} }
function notify(observer, key, dep) { function notify(observer, key, dep) {
dep.notify(); dep.notify({ observer: observer, key: key });
if (observer) { if (observer) {
//触发a.*绑定的依赖 //触发a.*绑定的依赖
_.each(observer._deps, function (dep) { _.each(observer._deps, function (dep) {
dep.notify(); dep.notify({ observer: observer, key: key });
}); });
//触发a.**绑定的依赖 //触发a.**绑定的依赖
var parent = observer, var parent = observer,
@ -34366,7 +34366,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
route = key || ""; route = key || "";
while (parent) { while (parent) {
_.each(parent._scopeDeps, function (dep) { _.each(parent._scopeDeps, function (dep) {
dep.notify(); dep.notify({ observer: observer, key: key });
}); });
if (parent.parentKey != null) { if (parent.parentKey != null) {
route = parent.parentKey + '.' + route; route = parent.parentKey + '.' + route;
@ -34377,7 +34377,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
for (var _key2 in root._globalDeps) { for (var _key2 in root._globalDeps) {
var reg = new RegExp(_key2); var reg = new RegExp(_key2);
if (reg.test(route)) { if (reg.test(route)) {
root._globalDeps[_key2].notify(); root._globalDeps[_key2].notify({ observer: observer, key: _key2 });
} }
} }
} }
@ -34549,7 +34549,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
function flushSchedulerQueue() { function flushSchedulerQueue() {
flushing = true; flushing = true;
var watcher = void 0, var watcher = void 0,
id = void 0; id = void 0,
options = void 0;
// Sort queue before flush. // Sort queue before flush.
// This ensures that: // This ensures that:
@ -34566,29 +34567,30 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
// do not cache length because more watchers might be pushed // do not cache length because more watchers might be pushed
// as we run existing watchers // as we run existing watchers
for (index = 0; index < queue.length; index++) { for (index = 0; index < queue.length; index++) {
watcher = queue[index]; watcher = queue[index].watcher;
options = queue[index].options;
id = watcher.id; id = watcher.id;
has[id] = null; has[id] = null;
watcher.run(); watcher.run(options);
} }
resetSchedulerState(); resetSchedulerState();
} }
function queueWatcher(watcher) { function queueWatcher(watcher, options) {
var id = watcher.id; var id = watcher.id;
if (has[id] == null) { if (has[id] == null) {
has[id] = true; has[id] = true;
if (!flushing) { if (!flushing) {
queue.push(watcher); queue.push({ watcher: watcher, options: options });
} else { } else {
// if already flushing, splice the watcher based on its id // if already flushing, splice the watcher based on its id
// if already past its id, it will be run next immediately. // if already past its id, it will be run next immediately.
var i = queue.length - 1; var i = queue.length - 1;
while (i > index && queue[i].id > watcher.id) { while (i > index && queue[i].watcher.id > watcher.id) {
i--; i--;
} }
queue.splice(i + 1, 0, watcher); queue.splice(i + 1, 0, { watcher: watcher, options: options });
} }
// queue the flush // queue the flush
if (!waiting) { if (!waiting) {
@ -34689,18 +34691,18 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
this.newDeps.length = 0; this.newDeps.length = 0;
}; };
Watcher.prototype.update = function update() { Watcher.prototype.update = function update(options) {
/* istanbul ignore else */ /* istanbul ignore else */
if (this.lazy) { if (this.lazy) {
this.dirty = true; this.dirty = true;
} else if (this.sync) { } else if (this.sync) {
this.run(); this.run(options);
} else { } else {
queueWatcher(this); queueWatcher(this, options);
} }
}; };
Watcher.prototype.run = function run() { Watcher.prototype.run = function run(options) {
if (this.active) { if (this.active) {
var value = this.get(); var value = this.get();
if (value !== this.value || if (value !== this.value ||
@ -34713,11 +34715,11 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
this.value = value; this.value = value;
if (this.user) { if (this.user) {
// try { // try {
this.cb.call(this.vm, value, oldValue); this.cb.call(this.vm, value, oldValue, options);
// } catch (e) { // } catch (e) {
// } // }
} else { } else {
this.cb.call(this.vm, value, oldValue); this.cb.call(this.vm, value, oldValue, options);
} }
} }
} }
@ -34836,14 +34838,14 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var fns = exps.slice(); var fns = exps.slice();
var complete = false, var complete = false,
running = false; running = false;
var callback = function callback(index, newValue, oldValue) { var callback = function callback(index, newValue, oldValue, options) {
if (complete === true) { if (complete === true) {
return; return;
} }
fns[index] = true; fns[index] = true;
if (runBinaryFunction(fns)) { if (runBinaryFunction(fns)) {
complete = true; complete = true;
cb(newValue, oldValue, index); cb(newValue, oldValue, options);
} }
if (!running) { if (!running) {
running = true; running = true;
@ -34881,8 +34883,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var w = new Watcher(model, function () { var w = new Watcher(model, function () {
dep.depend(); dep.depend();
return NaN; return NaN;
}, function (newValue, oldValue) { }, function (newValue, oldValue, opt) {
callback(i, newValue, oldValue); callback(i, newValue, oldValue, _.extend({ index: i, options: opt }));
}); });
watchers.push(function unwatchFn() { watchers.push(function unwatchFn() {
w.teardown(); w.teardown();
@ -34922,8 +34924,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var _w = new Watcher(currentModel, function () { var _w = new Watcher(currentModel, function () {
_dep.depend(); _dep.depend();
return NaN; return NaN;
}, function (newValue, oldValue) { }, function (newValue, oldValue, opt) {
callback(i, newValue, oldValue); callback(i, newValue, oldValue, _.extend({ index: i, options: opt }));
}); });
watchers.push(function unwatchFn() { watchers.push(function unwatchFn() {
_w.teardown(); _w.teardown();
@ -34931,8 +34933,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
}); });
return; return;
} }
var watcher = new Watcher(model, exp, function (newValue, oldValue) { var watcher = new Watcher(model, exp, function (newValue, oldValue, opt) {
callback(i, newValue, oldValue); callback(i, newValue, oldValue, _.extend({ index: i, options: opt }));
}, options); }, options);
watchers.push(function unwatchFn() { watchers.push(function unwatchFn() {
watcher.teardown(); watcher.teardown();

82
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

82
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

56
dist/fix/fix.js vendored

@ -190,11 +190,11 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
} }
}; };
Dep.prototype.notify = function notify() { Dep.prototype.notify = function notify(options) {
// stabilize the subscriber list first // stabilize the subscriber list first
var subs = this.subs.slice(); var subs = this.subs.slice();
for (var i = 0, l = subs.length; i < l; i++) { for (var i = 0, l = subs.length; i < l; i++) {
subs[i].update(); subs[i].update(options);
} }
}; };
@ -458,11 +458,11 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
} }
function notify(observer, key, dep) { function notify(observer, key, dep) {
dep.notify(); dep.notify({ observer: observer, key: key });
if (observer) { if (observer) {
//触发a.*绑定的依赖 //触发a.*绑定的依赖
_.each(observer._deps, function (dep) { _.each(observer._deps, function (dep) {
dep.notify(); dep.notify({ observer: observer, key: key });
}); });
//触发a.**绑定的依赖 //触发a.**绑定的依赖
var parent = observer, var parent = observer,
@ -470,7 +470,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
route = key || ""; route = key || "";
while (parent) { while (parent) {
_.each(parent._scopeDeps, function (dep) { _.each(parent._scopeDeps, function (dep) {
dep.notify(); dep.notify({ observer: observer, key: key });
}); });
if (parent.parentKey != null) { if (parent.parentKey != null) {
route = parent.parentKey + '.' + route; route = parent.parentKey + '.' + route;
@ -481,7 +481,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
for (var _key2 in root._globalDeps) { for (var _key2 in root._globalDeps) {
var reg = new RegExp(_key2); var reg = new RegExp(_key2);
if (reg.test(route)) { if (reg.test(route)) {
root._globalDeps[_key2].notify(); root._globalDeps[_key2].notify({ observer: observer, key: _key2 });
} }
} }
} }
@ -653,7 +653,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
function flushSchedulerQueue() { function flushSchedulerQueue() {
flushing = true; flushing = true;
var watcher = void 0, var watcher = void 0,
id = void 0; id = void 0,
options = void 0;
// Sort queue before flush. // Sort queue before flush.
// This ensures that: // This ensures that:
@ -670,29 +671,30 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
// do not cache length because more watchers might be pushed // do not cache length because more watchers might be pushed
// as we run existing watchers // as we run existing watchers
for (index = 0; index < queue.length; index++) { for (index = 0; index < queue.length; index++) {
watcher = queue[index]; watcher = queue[index].watcher;
options = queue[index].options;
id = watcher.id; id = watcher.id;
has[id] = null; has[id] = null;
watcher.run(); watcher.run(options);
} }
resetSchedulerState(); resetSchedulerState();
} }
function queueWatcher(watcher) { function queueWatcher(watcher, options) {
var id = watcher.id; var id = watcher.id;
if (has[id] == null) { if (has[id] == null) {
has[id] = true; has[id] = true;
if (!flushing) { if (!flushing) {
queue.push(watcher); queue.push({ watcher: watcher, options: options });
} else { } else {
// if already flushing, splice the watcher based on its id // if already flushing, splice the watcher based on its id
// if already past its id, it will be run next immediately. // if already past its id, it will be run next immediately.
var i = queue.length - 1; var i = queue.length - 1;
while (i > index && queue[i].id > watcher.id) { while (i > index && queue[i].watcher.id > watcher.id) {
i--; i--;
} }
queue.splice(i + 1, 0, watcher); queue.splice(i + 1, 0, { watcher: watcher, options: options });
} }
// queue the flush // queue the flush
if (!waiting) { if (!waiting) {
@ -793,18 +795,18 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
this.newDeps.length = 0; this.newDeps.length = 0;
}; };
Watcher.prototype.update = function update() { Watcher.prototype.update = function update(options) {
/* istanbul ignore else */ /* istanbul ignore else */
if (this.lazy) { if (this.lazy) {
this.dirty = true; this.dirty = true;
} else if (this.sync) { } else if (this.sync) {
this.run(); this.run(options);
} else { } else {
queueWatcher(this); queueWatcher(this, options);
} }
}; };
Watcher.prototype.run = function run() { Watcher.prototype.run = function run(options) {
if (this.active) { if (this.active) {
var value = this.get(); var value = this.get();
if (value !== this.value || if (value !== this.value ||
@ -817,11 +819,11 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
this.value = value; this.value = value;
if (this.user) { if (this.user) {
// try { // try {
this.cb.call(this.vm, value, oldValue); this.cb.call(this.vm, value, oldValue, options);
// } catch (e) { // } catch (e) {
// } // }
} else { } else {
this.cb.call(this.vm, value, oldValue); this.cb.call(this.vm, value, oldValue, options);
} }
} }
} }
@ -940,14 +942,14 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var fns = exps.slice(); var fns = exps.slice();
var complete = false, var complete = false,
running = false; running = false;
var callback = function callback(index, newValue, oldValue) { var callback = function callback(index, newValue, oldValue, options) {
if (complete === true) { if (complete === true) {
return; return;
} }
fns[index] = true; fns[index] = true;
if (runBinaryFunction(fns)) { if (runBinaryFunction(fns)) {
complete = true; complete = true;
cb(newValue, oldValue, index); cb(newValue, oldValue, options);
} }
if (!running) { if (!running) {
running = true; running = true;
@ -985,8 +987,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var w = new Watcher(model, function () { var w = new Watcher(model, function () {
dep.depend(); dep.depend();
return NaN; return NaN;
}, function (newValue, oldValue) { }, function (newValue, oldValue, opt) {
callback(i, newValue, oldValue); callback(i, newValue, oldValue, _.extend({ index: i, options: opt }));
}); });
watchers.push(function unwatchFn() { watchers.push(function unwatchFn() {
w.teardown(); w.teardown();
@ -1026,8 +1028,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var _w = new Watcher(currentModel, function () { var _w = new Watcher(currentModel, function () {
_dep.depend(); _dep.depend();
return NaN; return NaN;
}, function (newValue, oldValue) { }, function (newValue, oldValue, opt) {
callback(i, newValue, oldValue); callback(i, newValue, oldValue, _.extend({ index: i, options: opt }));
}); });
watchers.push(function unwatchFn() { watchers.push(function unwatchFn() {
_w.teardown(); _w.teardown();
@ -1035,8 +1037,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
}); });
return; return;
} }
var watcher = new Watcher(model, exp, function (newValue, oldValue) { var watcher = new Watcher(model, exp, function (newValue, oldValue, opt) {
callback(i, newValue, oldValue); callback(i, newValue, oldValue, _.extend({ index: i, options: opt }));
}, options); }, options);
watchers.push(function unwatchFn() { watchers.push(function unwatchFn() {
watcher.teardown(); watcher.teardown();

Loading…
Cancel
Save