Stop listening for image decoding

This commit is contained in:
Tim Schaub
2019-05-16 08:06:12 -06:00
parent 442fbb13d2
commit ee9a0bcd05
3 changed files with 40 additions and 26 deletions
+6 -3
View File
@@ -7,7 +7,7 @@ import EventTarget from '../events/Target.js';
import EventType from '../events/EventType.js';
import ImageState from '../ImageState.js';
import {shared as iconImageCache} from './IconImageCache.js';
import {listenImage, unlistenImage} from '../Image.js';
import {listenImage} from '../Image.js';
class IconImage extends EventTarget {
@@ -191,7 +191,7 @@ class IconImage extends EventTarget {
} catch (e) {
this.handleImageError_();
}
this.imageListenerKeys_ = listenImage(
this.unlisten_ = listenImage(
this.image_,
this.handleImageLoad_.bind(this),
this.handleImageError_.bind(this)
@@ -233,7 +233,10 @@ class IconImage extends EventTarget {
* @private
*/
unlistenImage_() {
unlistenImage(this.imageListenerKeys_);
if (this.unlisten_) {
this.unlisten_();
this.unlisten_ = null;
}
}
}