<commit_before>import {bindable, customAttribute} from 'aurelia-templating';
import {bindingMode} from 'aurelia-binding';
import {inject} from 'aurelia-dependency-injection';
import {getBooleanFromAttributeValue} from '../common/attributes';
// import {fireEvent} from '../common/events';

// Materialize doesn't present the full api.
// See here for full api: https://github.com/weareoutman/clockpicker

@inject(Element)
@customAttribute('md-timepicker')
export class MdTimePicker {
  @bindable() twelveHour = false;
  @bindable({defaultBindingMode: bindingMode.twoWay}) value;

  constructor(element) {
    this.element = element;
  }

  bind() {
    this.twelveHour = getBooleanFromAttributeValue(this.twelveHour);
  }

  attached() {
    let options = {
      afterDone: this.afterDone.bind(this),
      twelvehour: this.twelveHour
    };
    $(this.element).pickatime(options);
    this.element.value = this.value;
  }

  detached() {
    $(this.element).pickatime('remove');
  }

  afterDone() {
    this.value = this.element.value;
  }

  valueChanged(newValue) {
    this.element.value = newValue;
  }
}
<commit_msg>fix(md-timepicker): listen for change event on input, enabling clear btn, #480<commit_after>import {bindable, customAttribute} from 'aurelia-templating';
import {bindingMode} from 'aurelia-binding';
import {inject} from 'aurelia-dependency-injection';
import {getBooleanFromAttributeValue} from '../common/attributes';
// import {fireEvent} from '../common/events';

// Materialize doesn't present the full api.
// See here for full api: https://github.com/weareoutman/clockpicker

@inject(Element)
@customAttribute('md-timepicker')
export class MdTimePicker {
  @bindable() twelveHour = false;
  @bindable({defaultBindingMode: bindingMode.twoWay}) value;

  constructor(element) {
    this.element = element;
    this.updateFromElement = this.updateFromElement.bind(this);
  }

  bind() {
    this.twelveHour = getBooleanFromAttributeValue(this.twelveHour);
  }

  attached() {
    let options = {
      twelvehour: this.twelveHour
    };
    $(this.element).pickatime(options);
    this.element.value = this.value;
    $(this.element).on('change', this.updateFromElement);
  }

  detached() {
    $(this.element).off('change', this.updateFromElement);
    $(this.element).pickatime('remove');
  }

  updateFromElement() {
    this.value = this.element.value;
  }

  valueChanged(newValue) {
    this.element.value = newValue;
  }
}

{'fraction_non_alphanumeric': 0.14076484947111473, 'fraction_numerical': 0.0012205044751830757, 'mean_word_length': 4.187763713080169, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '3685509', 'n_tokens_mistral': 791, 'n_tokens_neox': 770, 'n_words': 150}