mirror of https://github.com/zulip/zulip.git
notifications: Use addEventListener to register handlers.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
parent
cb52f4d7fc
commit
f277eb022c
|
@ -266,6 +266,8 @@ run_test('basic_notifications', () => {
|
||||||
last_shown_message_id = this.tag;
|
last_shown_message_id = this.tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addEventListener() {}
|
||||||
|
|
||||||
close() {
|
close() {
|
||||||
last_closed_message_id = this.tag;
|
last_closed_message_id = this.tag;
|
||||||
}
|
}
|
||||||
|
|
|
@ -385,16 +385,16 @@ function process_notification(notification) {
|
||||||
msg_count: msg_count,
|
msg_count: msg_count,
|
||||||
message_id: message.id,
|
message_id: message.id,
|
||||||
});
|
});
|
||||||
notification_object.onclick = function () {
|
notification_object.addEventListener("click", () => {
|
||||||
notification_object.close();
|
notification_object.close();
|
||||||
if (message.type !== "test-notification") {
|
if (message.type !== "test-notification") {
|
||||||
narrow.by_topic(message.id, {trigger: 'notification'});
|
narrow.by_topic(message.id, {trigger: 'notification'});
|
||||||
}
|
}
|
||||||
window.focus();
|
window.focus();
|
||||||
};
|
});
|
||||||
notification_object.onclose = function () {
|
notification_object.addEventListener("close", () => {
|
||||||
notice_memory.delete(key);
|
notice_memory.delete(key);
|
||||||
};
|
});
|
||||||
} else {
|
} else {
|
||||||
in_browser_notify(message, title, content, raw_operators, opts);
|
in_browser_notify(message, title, content, raw_operators, opts);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue