Sharkey/src/web/app/desktop/scripts/stream.js

41 lines
1.1 KiB
JavaScript
Raw Normal View History

2017-02-18 05:23:23 +01:00
const stream = require('../../common/scripts/stream');
const getPostSummary = require('../../common/scripts/get-post-summary');
module.exports = me => {
const s = stream(me);
s.event.on('drive_file_created', file => {
const n = new Notification('ファイルがアップロードされました', {
body: file.name,
icon: file.url + '?thumbnail&size=64'
});
setTimeout(n.close.bind(n), 5000);
});
s.event.on('mention', post => {
2017-06-06 16:19:48 +02:00
const n = new Notification(`${post.user.name}さんから:`, {
2017-02-18 05:23:23 +01:00
body: getPostSummary(post),
icon: post.user.avatar_url + '?thumbnail&size=64'
});
setTimeout(n.close.bind(n), 6000);
});
s.event.on('reply', post => {
2017-06-06 16:19:48 +02:00
const n = new Notification(`${post.user.name}さんから返信:`, {
2017-02-18 05:23:23 +01:00
body: getPostSummary(post),
icon: post.user.avatar_url + '?thumbnail&size=64'
});
setTimeout(n.close.bind(n), 6000);
});
s.event.on('quote', post => {
2017-06-06 16:19:48 +02:00
const n = new Notification(`${post.user.name}さんが引用:`, {
2017-02-18 05:23:23 +01:00
body: getPostSummary(post),
icon: post.user.avatar_url + '?thumbnail&size=64'
});
setTimeout(n.close.bind(n), 6000);
});
2017-03-18 12:05:11 +01:00
return s;
2017-02-18 05:23:23 +01:00
};