Use Q deferred instead of native promise (IE11)

This commit is contained in:
juliandescottes 2017-02-11 16:57:56 +01:00
parent c68b82339c
commit c6c64af2fd

View File

@ -56,9 +56,9 @@
// Prepare a frames array to store frame objects extracted from the chunks.
var frames = [];
Promise.all(chunks.map(function (chunk) {
Q.all(chunks.map(function (chunk) {
// Create a promise for each chunk.
return new Promise(function (resolve, reject) {
var deferred = Q.defer();
var image = new Image();
// Load the chunk image in an Image object.
image.onload = function () {
@ -68,10 +68,10 @@
chunkFrames.forEach(function (chunkFrame) {
frames[chunkFrame.index] = chunkFrame.frame;
});
resolve();
deferred.resolve();
};
image.src = chunk.base64PNG;
});
return deferred.promise;
})).then(function () {
frames.forEach(layer.addFrame.bind(layer));
this.layers_[index] = layer;