<commit_before>import Ember from 'ember';
import QRCode from 'qrcode';

export default Ember.Component.extend({

  text: null,

  light: '#ffffff',

  colorDark: '#000000',

  width: 128,

  height: 128,

  // L/M/Q/H
  correctLevel: 'Q',

  didInsertElement: function() {
    const text = this.get('text');
    const elementId = this.get('elementId');
    const correctLevel = this.get('correctLevel');
    const colorLight = this.get('colorLight');
    const colorDark = this.get('colorDark');
    const width = this.get('width');
    const height = this.get('height');
    
    let qrcode = new QRCode(elementId, {
      text,
      width,
      height,
      colorDark,
      colorLight,
      correctLevel: QRCode.CorrectLevel[correctLevel],
    });
    this.set('qrcode', qrcode);
  },

  willDestroyElement: function() {
    this.get('qrcode').clear();
  },
});<commit_msg>Update QRCode when text attribute is changed<commit_after>import Ember from 'ember';
import QRCode from 'qrcode';

export default Ember.Component.extend({

  text: null,

  light: '#ffffff',

  colorDark: '#000000',

  width: 128,

  height: 128,

  // L/M/Q/H
  correctLevel: 'Q',

  didInsertElement: function() {
    const text = this.get('text');
    const elementId = this.get('elementId');
    const correctLevel = this.get('correctLevel');
    const colorLight = this.get('colorLight');
    const colorDark = this.get('colorDark');
    const width = this.get('width');
    const height = this.get('height');
    
    let qrcode = new QRCode(elementId, {
      text,
      width,
      height,
      colorDark,
      colorLight,
      correctLevel: QRCode.CorrectLevel[correctLevel],
    });
    this.set('qrcode', qrcode);
  },

  willDestroyElement: function() {
    this.get('qrcode').clear();
  },

  _recreateCode: Ember.observer('text', function() {
    this.get('qrcode').makeCode(this.get('text'));
  })
});
{'fraction_non_alphanumeric': 0.1551814834297738, 'fraction_numerical': 0.01262493424513414, 'mean_word_length': 3.2266666666666666, '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': '785731', 'n_tokens_mistral': 658, 'n_tokens_neox': 599, 'n_words': 136}