notifications: Use addEventListener to register handlers.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg 2020-04-26 15:37:01 -07:00 committed by Tim Abbott
parent cb52f4d7fc
commit f277eb022c
2 changed files with 6 additions and 4 deletions

View File

@ -266,6 +266,8 @@ run_test('basic_notifications', () => {
last_shown_message_id = this.tag;
}
addEventListener() {}
close() {
last_closed_message_id = this.tag;
}

View File

@ -385,16 +385,16 @@ function process_notification(notification) {
msg_count: msg_count,
message_id: message.id,
});
notification_object.onclick = function () {
notification_object.addEventListener("click", () => {
notification_object.close();
if (message.type !== "test-notification") {
narrow.by_topic(message.id, {trigger: 'notification'});
}
window.focus();
};
notification_object.onclose = function () {
});
notification_object.addEventListener("close", () => {
notice_memory.delete(key);
};
});
} else {
in_browser_notify(message, title, content, raw_operators, opts);
}