summaryrefslogtreecommitdiff
path: root/src/web/app/desktop/script.js
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-06-14 04:16:58 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-06-14 04:16:58 +0900
commit969cfe8a08a7fe3f2503ad96638496545513d683 (patch)
treefe7ab198b36756692e1621609d8618d21ab0e620 /src/web/app/desktop/script.js
parentClean up (diff)
downloadmisskey-969cfe8a08a7fe3f2503ad96638496545513d683.tar.gz
misskey-969cfe8a08a7fe3f2503ad96638496545513d683.tar.bz2
misskey-969cfe8a08a7fe3f2503ad96638496545513d683.zip
[Client:Desktop] Show a notification when received a new message
Diffstat (limited to 'src/web/app/desktop/script.js')
-rw-r--r--src/web/app/desktop/script.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/web/app/desktop/script.js b/src/web/app/desktop/script.js
index f9f0896ddd..2e81147943 100644
--- a/src/web/app/desktop/script.js
+++ b/src/web/app/desktop/script.js
@@ -74,4 +74,18 @@ function registerNotifications(stream) {
});
setTimeout(n.close.bind(n), 6000);
});
+
+ stream.on('unread_messaging_message', message => {
+ const n = new Notification(`${message.user.name}さんからメッセージ:`, {
+ body: message.text, // TODO: getMessagingMessageSummary(message),
+ icon: message.user.avatar_url + '?thumbnail&size=64'
+ });
+ n.onclick = () => {
+ n.close();
+ riot.mount(document.body.appendChild(document.createElement('mk-messaging-room-window')), {
+ user: message.user
+ });
+ };
+ setTimeout(n.close.bind(n), 7000);
+ });
}