<commit_before>/*
 *  This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
 *  License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
 */

/*
The stopwatch component
*/

import { Button, Row, Col } from "antd";
import {
  DeleteTwoTone,
  PauseCircleTwoTone,
  PlayCircleTwoTone,
  StopTwoTone,
} from "@ant-design/icons";
import { Component, React, Rendered } from "../app-framework";
import { TimerState } from "./actions";
import { TextInput } from "../r_misc/text-input";
import { webapp_client } from "../webapp-client";

function assertNever(x: never): never {
  throw new Error("Unexpected object: " + x);
}

interface StopwatchProps {
  state: TimerState; // 'paused' or 'running' or 'stopped'
  time: number; // when entered this state
  click_button: (str: string) => void;
  set_label: (str: string) => void;
  compact?: boolean;
  label?: string; // a text label
  total?: number; // total time accumulated before entering current state
}

interface StopwatchState {
  editing_label: boolean;
}

export class Stopwatch extends Component<StopwatchProps, StopwatchState> {
  private intervals: number[];

  constructor(props) {
    super(props);
    this.state = { editing_label: false };
  }

  public componentWillMount(): void {
    this.intervals = [];
  }

  private setInterval(fn: Function, ms: number): void {
    this.intervals.push(setInterval(fn, ms));
  }

  public componentWillUnmount(): void {<commit_msg>get rid of a componentWillMount<commit_after>/*
 *  This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
 *  License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
 */

/*
The stopwatch component
*/

import { Button, Row, Col } from "antd";
import {
  DeleteTwoTone,
  PauseCircleTwoTone,
  PlayCircleTwoTone,
  StopTwoTone,
} from "@ant-design/icons";
import { Component, React, Rendered } from "../app-framework";
import { TimerState } from "./actions";
import { TextInput } from "../r_misc/text-input";
import { webapp_client } from "../webapp-client";

function assertNever(x: never): never {
  throw new Error("Unexpected object: " + x);
}

interface StopwatchProps {
  state: TimerState; // 'paused' or 'running' or 'stopped'
  time: number; // when entered this state
  click_button: (str: string) => void;
  set_label: (str: string) => void;
  compact?: boolean;
  label?: string; // a text label
  total?: number; // total time accumulated before entering current state
}

interface StopwatchState {
  editing_label: boolean;
}

export class Stopwatch extends Component<StopwatchProps, StopwatchState> {
  private intervals: number[] = [];

  constructor(props) {
    super(props);
    this.state = { editing_label: false };
  }

  private setInterval(fn: Function, ms: number): void {
    this.intervals.push(setInterval(fn, ms));
  }

  public componentWillUnmount(): void {
{'fraction_non_alphanumeric': 0.13134851138353765, 'fraction_numerical': 0.0035026269702276708, 'mean_word_length': 4.019332161687171, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '3938739', 'n_tokens_mistral': 912, 'n_tokens_neox': 885, 'n_words': 274}