From 5c0680397de9d3cfd0018743e0b1d58dfbdca25d Mon Sep 17 00:00:00 2001
From: JoramWilander <jwawilander@gmail.com>
Date: Tue, 8 Sep 2015 10:11:57 -0400
Subject: Add post list container to hold mounted post lists for faster
 rendering/channel switching.

---
 web/react/stores/channel_store.jsx | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

(limited to 'web/react/stores/channel_store.jsx')

diff --git a/web/react/stores/channel_store.jsx b/web/react/stores/channel_store.jsx
index bd655b767..b9ba37c27 100644
--- a/web/react/stores/channel_store.jsx
+++ b/web/react/stores/channel_store.jsx
@@ -10,6 +10,7 @@ var ActionTypes = Constants.ActionTypes;
 var BrowserStore = require('../stores/browser_store.jsx');
 
 var CHANGE_EVENT = 'change';
+var LEAVE_EVENT = 'leave';
 var MORE_CHANGE_EVENT = 'change';
 var EXTRA_INFO_EVENT = 'extra_info';
 
@@ -48,6 +49,15 @@ class ChannelStoreClass extends EventEmitter {
     removeExtraInfoChangeListener(callback) {
         this.removeListener(EXTRA_INFO_EVENT, callback);
     }
+    emitLeave(id) {
+        this.emit(LEAVE_EVENT, id);
+    }
+    addLeaveListener(callback) {
+        this.on(LEAVE_EVENT, callback);
+    }
+    removeLeaveListener(callback) {
+        this.removeListener(LEAVE_EVENT, callback);
+    }
     findFirstBy(field, value) {
         var channels = this.pGetChannels();
         for (var i = 0; i < channels.length; i++) {
@@ -272,6 +282,10 @@ ChannelStore.dispatchToken = AppDispatcher.register(function handleAction(payloa
         ChannelStore.emitExtraInfoChange();
         break;
 
+    case ActionTypes.LEAVE_CHANNEL:
+        ChannelStore.emitLeave(action.id);
+        break;
+
     default:
         break;
     }
-- 
cgit v1.2.3-1-g7c22

