2017-06-29 07:06:05 +02:00

17 lines
429 B
JavaScript

import Cookie from 'js-cookie';
import debounce from 'lodash/debounce';
import { getSelectedTab } from 'state/tab';
import { observe } from 'util/observe';
const saveTab = debounce(tab =>
Cookie.set('tab', tab.toString(), { expires: 30 })
, 1000);
export default function storage({ store }) {
observe(store, getSelectedTab, tab => {
if (tab.isChannel() || (tab.server && !tab.name)) {
saveTab(tab);
}
});
}