Skip to content

Commit

Permalink
Merge pull request #138 from srhb18/master
Browse files Browse the repository at this point in the history
增加对pendingWorkers的处理前判定
  • Loading branch information
otakustay committed Jul 26, 2014
2 parents 801707a + 9c22d96 commit 7a8bd35
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) {
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 7a8bd35

Please sign in to comment.