mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
remove both handlers
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
parent
8b6ff533e8
commit
b42f7e1a36
@ -58,17 +58,14 @@ export class AvatarView extends BaseUpdateView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_addListenersToAvatar(image) {
|
_addListenersToAvatar(image) {
|
||||||
const handleAvatarError = (e) => {
|
const imageEventHandler = (e) => {
|
||||||
|
if(e.type === "error") { this._setAvatarError(); }
|
||||||
const image = e.target;
|
const image = e.target;
|
||||||
image.removeEventListener("load", removeErrorHandler);
|
image.removeEventListener("error", imageEventHandler);
|
||||||
this._setAvatarError();
|
image.removeEventListener("load", imageEventHandler);
|
||||||
};
|
};
|
||||||
const removeErrorHandler = (e) => {
|
image?.addEventListener("error", imageEventHandler);
|
||||||
const image = e.target;
|
image?.addEventListener("load", imageEventHandler);
|
||||||
image.removeEventListener("error", handleAvatarError);
|
|
||||||
};
|
|
||||||
image?.addEventListener("error", handleAvatarError);
|
|
||||||
image?.addEventListener("load", removeErrorHandler);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_avatarLetterChanged() {
|
_avatarLetterChanged() {
|
||||||
|
Loading…
Reference in New Issue
Block a user