import Reflux from 'reflux';

var ScrollActions = Reflux.createActions({
    // 暂无动作
    scrollTo: 1
});

var sidebarScrollPositionStore = Reflux.createStore({
    listenables: [ScrollActions],

    onScrollTo(targetUrl) {
        this._store.targetUrl = targetUrl;
        this.update();
    },

    _store: null,
    init() {
        this._store = {
            targetUrl: null
        };
    },
    update(store) {
        if (store) {
            this._store = store;
        }
        this.trigger(this._store);
    },
    getInitialState() {
        return this._store;
    }
});

export default {
    sidebarScrollPositionStore: sidebarScrollPositionStore,
    ScrollActions: ScrollActions,
}