<commit_before>import Ember from 'ember';
import layout from '../templates/components/ember-favourite-heart';

export default Ember.Component.extend({
  layout: layout,
  liked: false,
  likeCount: 0,

  heartClass: function(){
    if(this.get('liked')){
      return "heart heartAnimation";
    }else{
      return "heart";
    }
  }.property('liked'),

  heartStyle: function(){
    if(this.get('liked')){
      return "";
    }else{
      return "background-position: 0% 50%;";
    }
  }.property('liked'),

  like: function(){
    this.set('liked', true);
    this.set('likeCount', this.get('likeCount') + 1);
  },

  unlike: function(){
    this.set('liked', false);
    this.set('likeCount', this.get('likeCount') - 1);
  },

  actions: {
    toggleFav: function(){
      if(this.get('liked')){
        this.unlike();
      }else{
        this.like();
      }
      this.sendAction();
    }
  }<commit_msg>Use Ember.computed instead of using prototype extension<commit_after>import Ember from 'ember';
import layout from '../templates/components/ember-favourite-heart';

export default Ember.Component.extend({
  layout: layout,
  liked: false,
  likeCount: 0,

  heartClass: Ember.computed('liked', function() { 
    if(this.get('liked')){
      return "heart heartAnimation";
    }else{
      return "heart";
    }
  }),

  heartStyle: Ember.computed('liked', function() {
    if(this.get('liked')){
      return "";
    }else{
      return "background-position: 0% 50%;";
    }
  }),

  like: function(){
    this.set('liked', true);
    this.set('likeCount', this.get('likeCount') + 1);
  },

  unlike: function(){
    this.set('liked', false);
    this.set('likeCount', this.get('likeCount') - 1);
  },

  actions: {
    toggleFav: function(){
      if(this.get('liked')){
        this.unlike();
      }else{
        this.like();
      }
      this.sendAction();
    }
  }
{'fraction_non_alphanumeric': 0.1821561338289963, 'fraction_numerical': 0.006372809346787042, 'mean_word_length': 2.852760736196319, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6069854', 'n_tokens_mistral': 648, 'n_tokens_neox': 607, 'n_words': 124}