function() {
        this.input = this.$('#new-todo');
        this.allCheckbox = this.$('#toggle-all')[0];
        this.$footer = this.$('#footer');
        this.$main = this.$('#main');

        todos.on( 'add', this.addOne, this );
        todos.on( 'reset', this.addAll, this );
        todos.on( 'change:completed', this.filterOne, this );
        todos.on( "filter", this.filterAll, this);
        todos.on( 'all', this.render, this );

        todos.fetch();
    }
function() {
        this.input = this.$('#new-todo');
        this.allCheckbox = this.$('#toggle-all')[0];
        this.$footer = this.$('#footer');
        this.$main = this.$('#main');

        todos.on( 'add', this.addOne, this );
        todos.on( 'reset', this.addAll, this );
        todos.on( 'change:completed', this.filterOne, this );
        todos.on( "filter", this.filterAll, this);
        todos.on( 'all', this.render, this );

        todos.fetch();
    }
function ( ) { this . input = this . $ ( '#new-todo' ) ; this . allCheckbox = this . $ ( '#toggle-all' ) [ 0 ] ; this . $footer = this . $ ( '#footer' ) ; this . $main = this . $ ( '#main' ) ; todos . on ( 'add' , this . addOne , this ) ; todos . on ( 'reset' , this . addAll , this ) ; todos . on ( 'change:completed' , this . filterOne , this ) ; todos . on ( "filter" , this . filterAll , this ) ; todos . on ( 'all' , this . render , this ) ; todos . fetch ( ) ; }
At initialization we bind to the relevant events on the `Todos` collection, when items are added or changed. Kick things off by loading any preexisting todos that might be saved in *localStorage*.
At initialization we bind to the relevant events on the Todos collection when items are added or changed . Kick things off by loading any preexisting todos that might be saved in * localStorage * .