From b9a3ff74dd2b299ae4980922a6dcc55002662517 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Fri, 30 Oct 2015 14:29:15 -0400 Subject: Hooking up external components --- web/react/stores/post_store.jsx | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'web/react/stores') diff --git a/web/react/stores/post_store.jsx b/web/react/stores/post_store.jsx index 8f4e30e7c..19b200ac8 100644 --- a/web/react/stores/post_store.jsx +++ b/web/react/stores/post_store.jsx @@ -14,6 +14,7 @@ var ActionTypes = Constants.ActionTypes; var CHANGE_EVENT = 'change'; var SELECTED_POST_CHANGE_EVENT = 'selected_post_change'; var EDIT_POST_EVENT = 'edit_post'; +var POST_LIST_JUMP_EVENT = 'post_list_jump'; class PostStoreClass extends EventEmitter { constructor() { @@ -31,6 +32,10 @@ class PostStoreClass extends EventEmitter { this.addEditPostListener = this.addEditPostListener.bind(this); this.removeEditPostListener = this.removeEditPostListener.bind(this); + this.emitPostListJump = this.emitPostListJump.bind(this); + this.addPostListJumpListener = this.addPostListJumpListener.bind(this); + this.removePostListJumpListener = this.removePostListJumpListener.bind(this); + this.getCurrentPosts = this.getCurrentPosts.bind(this); this.storePosts = this.storePosts.bind(this); this.pStorePosts = this.pStorePosts.bind(this); @@ -100,6 +105,30 @@ class PostStoreClass extends EventEmitter { this.removeListener(EDIT_POST_EVENT, callback); } + emitPostListJump(type, post) { + this.emit(POST_LIST_JUMP_EVENT, type, post); + } + + addPostListJumpListener(callback) { + this.on(POST_LIST_JUMP_EVENT, callback); + } + + removePostListJumpListener(callback) { + this.removeListener(POST_LIST_JUMP_EVENT, callback); + } + + jumpPostListBottom() { + this.emitPostListJump(Constants.PostListJumpTypes.BOTTOM, null); + } + + jumpPostListToPost(post) { + this.emitPostListJump(Constants.PostListJumpTypes.POST, post); + } + + jumpPostListSidebarOpen() { + this.emitPostListJump(Constants.PostListJumpTypes.SIDEBAR_OPEN, null); + } + getCurrentPosts() { var currentId = ChannelStore.getCurrentId(); -- cgit v1.2.3-1-g7c22