Last active
May 8, 2016 17:46
-
-
Save ramonvictor/e20894711a0524a6ce43cc4c2344dbbd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var store = require('./store'); | |
var gridView = require('./grid-view'); | |
TicTacToe.prototype.eventListeners = function() { | |
store.subscribe(this.render.bind(this)); | |
}; | |
TicTacToe.prototype.render = function(prevState, state) { | |
// You can even check whether new state is different | |
if (prevState.grid !== state.grid) { | |
this.gridView.render('grid', state.grid); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment