Skip to content

Commit

Permalink
增加对pendingWorkers的处理前判定
Browse files Browse the repository at this point in the history
  • Loading branch information
srhb18 committed Jul 26, 2014
1 parent 801707a commit 9c22d96
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/Model.js
Original file line number Diff line number Diff line change
Expand Up @@ -639,13 +639,15 @@ define(
* 销毁当前{@link Model}对象,会尝试停止所有正在加载的数据
*/
Model.prototype.dispose = function () {
for (var i = 0; i < this.pendingWorkers.length; i++) {
var worker = this.pendingWorkers[i];
if (typeof worker.abort === 'function') {
try {
worker.abort();
}
catch (ex) {
if (this.pendingWorkers) {

This comment has been minimized.

Copy link
@bobshen

bobshen Aug 13, 2014

这行if判断有什么特殊意义么?循环本身不是可以判断么

还是说this.pendingWorkers会是null的情况?可是看起来销毁前都会是数组

for (var i = 0; i < this.pendingWorkers.length; i++) {
var worker = this.pendingWorkers[i];
if (typeof worker.abort === 'function') {
try {
worker.abort();
}
catch (ex) {
}
}
}
}
Expand Down

0 comments on commit 9c22d96

Please sign in to comment.