<commit_before>import Ember from "ember";


var bsSwitchComponent = Ember.Component.extend({

  tagName: 'div',
  classNames: ['bs-switch'],

  btnSize: 'small',
  name: 'bs-switch',
  disabled: false,

  // Insternal state.
  status: false,

  willDestroyElement: function() {
    // console.log('Destroy the instance of Bootstrap Switch.');
    this.$('input').bootstrapSwitch('destroy');
  },

  didInsertElement: function() {
    var that = this;

    // Ensure bootstrap-switch is loaded...
    Ember.assert("bootstrap-switch has to exist on Ember.$.fn.bootstrapSwitch", typeof Ember.$.fn.bootstrapSwitch === "function" );
    // console.log('this.$(input):', this.$('input'));

    this.$('input').bootstrapSwitch({
      "size": this.get('btnSize'),
      "state": this.get('status'),
      "disabled": this.get('disabled')
    });

    this.$('input').on('switchChange.bootstrapSwitch', function(event, state) {
      // console.log(this); // DOM element
      // console.log(event); // jQuery event
      // console.log(state); // true | false
      that.set('status', state);
      that.send('sendActionToConsumer', state);
    });
  },

  actions: {
    sendActionToConsumer: function(_state){
      this.sendAction('callback', {<commit_msg>Add text options and observer on the status property to update plugin on change<commit_after>import Ember from "ember";


var bsSwitchComponent = Ember.Component.extend({

  tagName: 'div',
  classNames: ['bs-switch'],

  btnSize: 'small',
  name: 'bs-switch',
  disabled: false,
  onText: 'ON',
  offText: 'OFF',
  labelText: '',

  // Insternal state.
  status: false,

  willDestroyElement: function() {
    // console.log('Destroy the instance of Bootstrap Switch.');
    this.$('input').bootstrapSwitch('destroy');
  },

  didInsertElement: function() {
    var that = this;

    // Ensure bootstrap-switch is loaded...
    Ember.assert("bootstrap-switch has to exist on Ember.$.fn.bootstrapSwitch", typeof Ember.$.fn.bootstrapSwitch === "function" );
    // console.log('this.$(input):', this.$('input'));

    this.$('input').bootstrapSwitch({
      "size": this.get('btnSize'),
      "state": this.get('status'),
      "disabled": this.get('disabled'),
      "onText": this.get('onText'),
      "offText": this.get('offText'),
      "labelText": this.get('labelText')
    });

    this.$('input').on('switchChange.bootstrapSwitch', function(event, state) {
      // console.log(this); // DOM element
      // console.log(event); // jQuery event
      // console.log(state); // true | false
      that.set('status', state);
      that.send('sendActionToConsumer', state);
    });
  },

  /**
   * Observes status for outside changes in order to update the plugin value.
   *
   * @method statusObserver
   * @private
   */
  _statusObserver: function() {
    this.$('input').bootstrapSwitch('state', this.get('status'), true);
  }.observes('status'),

  actions: {
    sendActionToConsumer: function(_state){
      this.sendAction('callback', {
{'fraction_non_alphanumeric': 0.17882117882117882, 'fraction_numerical': 0.0, 'mean_word_length': 3.3160919540229883, 'pattern_counts': {'":': 9, '<': 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': '5873722', 'n_tokens_mistral': 906, 'n_tokens_neox': 881, 'n_words': 199}