Skip to content

Instantly share code, notes, and snippets.

@allenfantasy
Created July 3, 2014 07:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save allenfantasy/cb5b4fc0afed049141d8 to your computer and use it in GitHub Desktop.
Save allenfantasy/cb5b4fc0afed049141d8 to your computer and use it in GitHub Desktop.
function _setListeners() {
this.heartSurface.on('click', this.clickListener.bind(this));
}
function HeartView() {
View.apply(this, arguments);
_createHeart.call(this); // create HeartSurface
_setListeners.call(this);
}
HeartView.prototype = Object.create(View.prototype);
HeartView.prototype.constructor = HeartView;
HeartView.prototype.clickListener = function() {
this._eventOutput.emit('sayThanks');
this._eventOutput.emit('updateCounter');
};
HeartView.prototype.removeClickListener = function() {
this.heartSurface.removeListener('click', this.clickListener.bind(this));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment