diff options
author | Christopher Speller <crspeller@gmail.com> | 2017-09-06 23:04:13 -0700 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2017-09-06 23:11:58 -0700 |
commit | d8bd57901e33a7057e26e782e295099ffcc0da89 (patch) | |
tree | e12dfc8cad42b1576756d19d7fbfd82646a009bf /webapp/stores/opengraph_store.jsx | |
parent | 7bc8e9a08dfde56387f946fdf5086252aa4d0491 (diff) | |
download | chat-d8bd57901e33a7057e26e782e295099ffcc0da89.tar.gz chat-d8bd57901e33a7057e26e782e295099ffcc0da89.tar.bz2 chat-d8bd57901e33a7057e26e782e295099ffcc0da89.zip |
Removing webapp
Diffstat (limited to 'webapp/stores/opengraph_store.jsx')
-rw-r--r-- | webapp/stores/opengraph_store.jsx | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/webapp/stores/opengraph_store.jsx b/webapp/stores/opengraph_store.jsx deleted file mode 100644 index 4ad156df0..000000000 --- a/webapp/stores/opengraph_store.jsx +++ /dev/null @@ -1,68 +0,0 @@ -import EventEmitter from 'events'; - -import AppDispatcher from 'dispatcher/app_dispatcher.jsx'; -import Constants from 'utils/constants.jsx'; - -const ActionTypes = Constants.ActionTypes; - -const CHANGE_EVENT = 'change'; -const URL_DATA_CHANGE_EVENT = 'url_data_change'; - -class OpenGraphStoreClass extends EventEmitter { - constructor() { - super(); - this.ogDataObject = {}; // Format: {<url>: <data-object>} - } - - emitChange() { - this.emit(CHANGE_EVENT); - } - - addChangeListener(callback) { - this.on(CHANGE_EVENT, callback); - } - - removeChangeListener(callback) { - this.removeListener(CHANGE_EVENT, callback); - } - - emitUrlDataChange(url) { - this.emit(URL_DATA_CHANGE_EVENT, url); - } - - addUrlDataChangeListener(callback) { - this.on(URL_DATA_CHANGE_EVENT, callback); - } - - removeUrlDataChangeListener(callback) { - this.removeListener(URL_DATA_CHANGE_EVENT, callback); - } - - storeOgInfo(url, ogInfo) { - this.ogDataObject[url] = ogInfo; - } - - getOgInfo(url) { - return this.ogDataObject[url]; - } -} - -var OpenGraphStore = new OpenGraphStoreClass(); - -// Not expecting more that `Constants.POST_CHUNK_SIZE` post previews rendered at a time -OpenGraphStore.setMaxListeners(Constants.POST_CHUNK_SIZE); - -OpenGraphStore.dispatchToken = AppDispatcher.register((payload) => { - var action = payload.action; - - switch (action.type) { - case ActionTypes.RECIVED_OPEN_GRAPH_METADATA: - OpenGraphStore.storeOgInfo(action.url, action.data); - OpenGraphStore.emitUrlDataChange(action.url); - OpenGraphStore.emitChange(); - break; - default: - } -}); - -export default OpenGraphStore; |