/**
 * Copyright 2014, Yahoo! Inc.
 * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
 */
'use strict';
var createStore = require('fluxible-app/utils/createStore');


var TimeStore = createStore({
    storeName: 'TimeStore',
    initialize: function (dispatcher) {
        this.time = new Date();
    },
    handleTimeChange: function (payload) {
        this.time = new Date();
        this.emit('change');
    },
    handlers: {
        'CHANGE_ROUTE_START': 'handleTimeChange',
        'UPDATE_TIME': 'handleTimeChange'
    },
    getState: function () {
        return {
            time: this.time.toString()
        };
    },
    dehydrate: function () {
        return this.getState();
    },
    rehydrate: function (state) {
        this.time = new Date(state.time);
    }
});


module.exports = TimeStore;

/**
 * Copyright 2014, Yahoo! Inc.
 * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
 */
'use strict';
var createStore = require('fluxible-app/utils/createStore');


var TimeStore = createStore({
    storeName: 'TimeStore',
    initialize: function (dispatcher) {
        this.time = new Date();
    },
    handleTimeChange: function (payload) {
        this.time = new Date();
        this.emitChange();
    },
    handlers: {
        'CHANGE_ROUTE_START': 'handleTimeChange',
        'UPDATE_TIME': 'handleTimeChange'
    },
    getState: function () {
        return {
            time: this.time.toString()
        };
    },
    dehydrate: function () {
        return this.getState();
    },
    rehydrate: function (state) {
        this.time = new Date(state.time);
    }
});


module.exports = TimeStore;

Use this.emitChange() instead of old API
Use this.emitChange() instead of old API