<commit_before>import template from './stopwatch.component.html';
import './stopwatch.component.scss';

export default function StopwatchComponent(appModule) {
  appModule.component('atStopwatch', {
    template: template,
    controller: StopwatchController
  });
}

class StopwatchController {
  constructor($filter, $interval, $scope, stopwatchService, voiceService) {
    'ngInject';
    this._$filter = $filter;
    this._$interval = $interval;
    this._$scope = $scope;
    this._stopwatchService = stopwatchService;
    this._voiceService = voiceService;
  }

  start() {
    this.running = true;
    this.cleared = false;
    this._intervalPromise = this._$interval(() => {
      this.time++;
      // if (this.time === 1 || this.time % 10 === 0) {
        let phrase = this._voiceService.getTimePhrase(this.time);
        this._voiceService.speak(phrase);
      // }
    }, 1000);
  }

  pause() {
    this.running = false;
    this._$interval.cancel(this._intervalPromise);
  }

  reset() {
    this._pause();
    this.cleared = true;
  }

  $onInit() {
    this.time = this._stopwatchService.time;
    this.running = false;
    this.cleared = true;<commit_msg>Move interval function to own class member<commit_after>import template from './stopwatch.component.html';
import './stopwatch.component.scss';

export default function StopwatchComponent(appModule) {
  appModule.component('atStopwatch', {
    template: template,
    controller: StopwatchController
  });
}

class StopwatchController {
  constructor($filter, $interval, $scope, stopwatchService, voiceService) {
    'ngInject';
    this._$filter = $filter;
    this._$interval = $interval;
    this._$scope = $scope;
    this._stopwatchService = stopwatchService;
    this._voiceService = voiceService;
  }

  start() {
    this.running = true;
    this.cleared = false;
    this._intervalPromise = this._$interval(this._intervalFn.bind(this), 1000);
  }

  _intervalFn() {
    this.time++;
    // if (this.time === 1 || this.time % 10 === 0) {
      let phrase = this._voiceService.getTimePhrase(this.time);
      this._voiceService.speak(phrase);
    // }
  }

  pause() {
    this.running = false;
    this._$interval.cancel(this._intervalPromise);
  }

  reset() {
    this._pause();
    this.cleared = true;
  }

  $onInit() {
    this.time = this._stopwatchService.time;
    this.running = false;
    this.cleared = true;
{'fraction_non_alphanumeric': 0.14083333333333334, 'fraction_numerical': 0.006666666666666667, 'mean_word_length': 3.227112676056338, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '5701884', 'n_tokens_mistral': 762, 'n_tokens_neox': 735, 'n_words': 140}