Skip to content

Instantly share code, notes, and snippets.

@aramkoukia
Created December 18, 2016 20:37
Show Gist options
  • Save aramkoukia/1bfde550f17056961f05ce88b5f15275 to your computer and use it in GitHub Desktop.
Save aramkoukia/1bfde550f17056961f05ce88b5f15275 to your computer and use it in GitHub Desktop.
behavior-factories defining the behaviours
var speaker = function (state) {
var words = state.words;
return {
talk: function () {
console.log(state.name + ' says ' + words);
}
};
};
var walker = function (state) {
return {
walk: function () {
console.log(state.name + ' is walking');
},
run: function () {
console.log(state.name + ' is running');
}
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment