examples/reflux/js/store.js
function() {
            var loadedList = localStorage.getItem(localStorageKey);
            if (!loadedList) {
                // If no list is in localstorage, start out with a default one
                this.list = [{
                    key: todoCounter++,
                    created: new Date(),
                    isComplete: false,
                    label: 'Rule the web'
                }];
            } else {
                this.list = _.map(JSON.parse(loadedList), function(item) {
                    // just resetting the key property for each todo item
                    item.key = todoCounter++;
                    return item;
                });
            }
            // Subscribe to RemoteDev
            RemoteDev.subscribe(state => {
                this.updateList(state);
            });
            RemoteDev.init(this.list);
            return this.list;
        }
function() {
            var loadedList = localStorage.getItem(localStorageKey);
            if (!loadedList) {
                // If no list is in localstorage, start out with a default one
                this.list = [{
                    key: todoCounter++,
                    created: new Date(),
                    isComplete: false,
                    label: 'Rule the web'
                }];
            } else {
                this.list = _.map(JSON.parse(loadedList), function(item) {
                    // just resetting the key property for each todo item
                    item.key = todoCounter++;
                    return item;
                });
            }
            // Subscribe to RemoteDev
            RemoteDev.subscribe(state => {
                this.updateList(state);
            });
            RemoteDev.init(this.list);
            return this.list;
        }
function ( ) { var loadedList = localStorage . getItem ( localStorageKey ) ; if ( ! loadedList ) { // If no list is in localstorage, start out with a default one this . list = [ { key : todoCounter ++ , created : new Date ( ) , isComplete : false , label : 'Rule the web' } ] ; } else { this . list = _ . map ( JSON . parse ( loadedList ) , function ( item ) { // just resetting the key property for each todo item item . key = todoCounter ++ ; return item ; } ) ; } // Subscribe to RemoteDev RemoteDev . subscribe ( state => { this . updateList ( state ) ; } ) ; RemoteDev . init ( this . list ) ; return this . list ; }
this will be called by all listening components as they register their listeners
this will be called by all listening components as they register their listeners