diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2017-03-20 14:49:24 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2017-03-20 14:49:24 +0900 |
| commit | b6475958d03a1d91651e11498f31a1ad0fa01925 (patch) | |
| tree | 437ba02c692490aade98a3e194434399669b31dc /src/web/app/mobile | |
| parent | v1398 (diff) | |
| download | misskey-b6475958d03a1d91651e11498f31a1ad0fa01925.tar.gz misskey-b6475958d03a1d91651e11498f31a1ad0fa01925.tar.bz2 misskey-b6475958d03a1d91651e11498f31a1ad0fa01925.zip | |
[Client] Refactoring
Diffstat (limited to 'src/web/app/mobile')
| -rw-r--r-- | src/web/app/mobile/tags/drive.tag | 18 | ||||
| -rw-r--r-- | src/web/app/mobile/tags/follow-button.tag | 10 | ||||
| -rw-r--r-- | src/web/app/mobile/tags/home-timeline.tag | 14 | ||||
| -rw-r--r-- | src/web/app/mobile/tags/notifications.tag | 6 | ||||
| -rw-r--r-- | src/web/app/mobile/tags/page/home.tag | 6 | ||||
| -rw-r--r-- | src/web/app/mobile/tags/timeline-post.tag | 4 | ||||
| -rw-r--r-- | src/web/app/mobile/tags/ui.tag | 7 |
7 files changed, 26 insertions, 39 deletions
diff --git a/src/web/app/mobile/tags/drive.tag b/src/web/app/mobile/tags/drive.tag index 7770bd66be..dfccc41e3b 100644 --- a/src/web/app/mobile/tags/drive.tag +++ b/src/web/app/mobile/tags/drive.tag @@ -159,8 +159,6 @@ this.mixin('api'); this.mixin('stream'); - const stream = this.stream.event; - this.files = []; this.folders = []; this.hierarchyFolders = []; @@ -176,10 +174,10 @@ this.multiple =this.opts.multiple; this.on('mount', () => { - stream.on('drive_file_created', this.onStreamDriveFileCreated); - stream.on('drive_file_updated', this.onStreamDriveFileUpdated); - stream.on('drive_folder_created', this.onStreamDriveFolderCreated); - stream.on('drive_folder_updated', this.onStreamDriveFolderUpdated); + this.stream.on('drive_file_created', this.onStreamDriveFileCreated); + this.stream.on('drive_file_updated', this.onStreamDriveFileUpdated); + this.stream.on('drive_folder_created', this.onStreamDriveFolderCreated); + this.stream.on('drive_folder_updated', this.onStreamDriveFolderUpdated); // Riotのバグでnullを渡しても""になる // https://github.com/riot/riot/issues/2080 @@ -195,10 +193,10 @@ }); this.on('unmount', () => { - stream.off('drive_file_created', this.onStreamDriveFileCreated); - stream.off('drive_file_updated', this.onStreamDriveFileUpdated); - stream.off('drive_folder_created', this.onStreamDriveFolderCreated); - stream.off('drive_folder_updated', this.onStreamDriveFolderUpdated); + this.stream.off('drive_file_created', this.onStreamDriveFileCreated); + this.stream.off('drive_file_updated', this.onStreamDriveFileUpdated); + this.stream.off('drive_folder_created', this.onStreamDriveFolderCreated); + this.stream.off('drive_folder_updated', this.onStreamDriveFolderUpdated); }); this.onStreamDriveFileCreated = file => { diff --git a/src/web/app/mobile/tags/follow-button.tag b/src/web/app/mobile/tags/follow-button.tag index 4f96afbdb7..c379733678 100644 --- a/src/web/app/mobile/tags/follow-button.tag +++ b/src/web/app/mobile/tags/follow-button.tag @@ -54,8 +54,6 @@ this.mixin('api'); this.mixin('stream'); - const stream = this.stream.event; - this.user = null; this.userPromise = isPromise(this.opts.user) ? this.opts.user @@ -69,14 +67,14 @@ init: false, user: user }); - stream.on('follow', this.onStreamFollow); - stream.on('unfollow', this.onStreamUnfollow); + this.stream.on('follow', this.onStreamFollow); + this.stream.on('unfollow', this.onStreamUnfollow); }); }); this.on('unmount', () => { - stream.off('follow', this.onStreamFollow); - stream.off('unfollow', this.onStreamUnfollow); + this.stream.off('follow', this.onStreamFollow); + this.stream.off('unfollow', this.onStreamUnfollow); }); this.onStreamFollow = user => { diff --git a/src/web/app/mobile/tags/home-timeline.tag b/src/web/app/mobile/tags/home-timeline.tag index 7c929fc5ad..aa12a7c10f 100644 --- a/src/web/app/mobile/tags/home-timeline.tag +++ b/src/web/app/mobile/tags/home-timeline.tag @@ -9,8 +9,6 @@ this.mixin('api'); this.mixin('stream'); - const stream = this.stream.event; - this.init = new Promise((res, rej) => { this.api('posts/timeline').then(posts => { res(posts); @@ -19,15 +17,15 @@ }); this.on('mount', () => { - stream.on('post', this.onStreamPost); - stream.on('follow', this.onStreamFollow); - stream.on('unfollow', this.onStreamUnfollow); + this.stream.on('post', this.onStreamPost); + this.stream.on('follow', this.onStreamFollow); + this.stream.on('unfollow', this.onStreamUnfollow); }); this.on('unmount', () => { - stream.off('post', this.onStreamPost); - stream.off('follow', this.onStreamFollow); - stream.off('unfollow', this.onStreamUnfollow); + this.stream.off('post', this.onStreamPost); + this.stream.off('follow', this.onStreamFollow); + this.stream.off('unfollow', this.onStreamUnfollow); }); this.more = () => { diff --git a/src/web/app/mobile/tags/notifications.tag b/src/web/app/mobile/tags/notifications.tag index 4f49edd5ac..d2396caa02 100644 --- a/src/web/app/mobile/tags/notifications.tag +++ b/src/web/app/mobile/tags/notifications.tag @@ -63,8 +63,6 @@ this.mixin('api'); this.mixin('stream'); - const stream = this.stream.event; - this.notifications = []; this.loading = true; @@ -78,11 +76,11 @@ this.trigger('fetched'); }); - stream.on('notification', this.onNotification); + this.stream.on('notification', this.onNotification); }); this.on('unmount', () => { - stream.off('notification', this.onNotification); + this.stream.off('notification', this.onNotification); }); this.onNotification = notification => { diff --git a/src/web/app/mobile/tags/page/home.tag b/src/web/app/mobile/tags/page/home.tag index 561e0be5f7..fffb685328 100644 --- a/src/web/app/mobile/tags/page/home.tag +++ b/src/web/app/mobile/tags/page/home.tag @@ -15,8 +15,6 @@ this.mixin('i'); this.mixin('stream'); - const stream = this.stream.event; - this.unreadCount = 0; this.on('mount', () => { @@ -29,7 +27,7 @@ Progress.start(); - stream.on('post', this.onStreamPost); + this.stream.on('post', this.onStreamPost); document.addEventListener('visibilitychange', this.onVisibilitychange, false); this.refs.ui.refs.home.on('loaded', () => { @@ -38,7 +36,7 @@ }); this.on('unmount', () => { - stream.off('post', this.onStreamPost); + this.stream.off('post', this.onStreamPost); document.removeEventListener('visibilitychange', this.onVisibilitychange); }); diff --git a/src/web/app/mobile/tags/timeline-post.tag b/src/web/app/mobile/tags/timeline-post.tag index 7f02dd4872..a492950fcb 100644 --- a/src/web/app/mobile/tags/timeline-post.tag +++ b/src/web/app/mobile/tags/timeline-post.tag @@ -345,7 +345,7 @@ type: 'capture', id: this.p.id }); - this.stream.event.on('post-updated', this.onStreamPostUpdated); + this.stream.on('post-updated', this.onStreamPostUpdated); }; this.decapture = () => { @@ -353,7 +353,7 @@ type: 'decapture', id: this.p.id }); - this.stream.event.off('post-updated', this.onStreamPostUpdated); + this.stream.off('post-updated', this.onStreamPostUpdated); }; this.on('mount', () => { diff --git a/src/web/app/mobile/tags/ui.tag b/src/web/app/mobile/tags/ui.tag index 4c0e825a71..b047af2649 100644 --- a/src/web/app/mobile/tags/ui.tag +++ b/src/web/app/mobile/tags/ui.tag @@ -12,19 +12,16 @@ </style> <script> this.mixin('i'); - this.mixin('stream'); - const stream = this.stream.event; - this.isDrawerOpening = false; this.on('mount', () => { - stream.on('notification', this.onStreamNotification); + this.stream.on('notification', this.onStreamNotification); }); this.on('unmount', () => { - stream.off('notification', this.onStreamNotification); + this.stream.off('notification', this.onStreamNotification); }); this.toggleDrawer = () => { |