From b569733f4355ed7c2fa78b9994ea1cc190a3eacc Mon Sep 17 00:00:00 2001 From: Francesco Esposito <33671357+frab1t@users.noreply.github.com> Date: Sat, 30 Mar 2019 19:04:49 +0100 Subject: [PATCH] Add dynamic title (timer) --- src/components/Timer.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/components/Timer.js b/src/components/Timer.js index 5342c77..b0e1c5e 100644 --- a/src/components/Timer.js +++ b/src/components/Timer.js @@ -8,6 +8,7 @@ import './Timer.css'; class Timer extends Component { constructor(props) { super(props); + this.appName = 'tomadoro'; this.state = { seconds: 0, started: false, @@ -46,6 +47,8 @@ class Timer extends Component { seconds: state.seconds - 1 })); + document.title=`(${this.formatMinute(this.state.seconds)}) ${this.appName}`; + if (this.state.seconds === 0) { this.stopTimer(); this.finishedTimer(); @@ -74,6 +77,8 @@ class Timer extends Component { } else { this.pomodoroMode(); } + + document.title = this.appName; } finishedTimer() {