Skip to content

Commit a8d1f8f

Browse files
committed
Added some more robust error handling to ImageLoader
1 parent be249c8 commit a8d1f8f

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/preloadjs/loaders/ImageLoader.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,12 @@ this.createjs = this.createjs || {};
158158
} else {
159159
tag.onload = createjs.proxy(function() {
160160
successCallback(this._tag);
161+
tag.onload = tag.onerror = null;
161162
}, this);
162163

163-
tag.onerror = createjs.proxy(function() {
164-
errorCallback(new createjs.ErrorEvent('IMAGE_FORMAT'));
164+
tag.onerror = createjs.proxy(function(event) {
165+
errorCallback(new createjs.ErrorEvent('IMAGE_FORMAT', null, event));
166+
tag.onload = tag.onerror = null;
165167
}, this);
166168
}
167169
};

0 commit comments

Comments
 (0)