Hooking up external components

Этот коммит содержится в:
Christopher Speller
2015-10-30 14:29:15 -04:00
родитель ed68f2e901
Коммит b9a3ff74dd
11 изменённых файлов: 220 добавлений и 65 удалений

Просмотреть файл

@@ -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();