From e37ce1496bb3fd2d3cfc211bc1b9ee4d79a9b284 Mon Sep 17 00:00:00 2001 From: Stephen Rodriguez Date: Wed, 10 Jun 2015 14:45:09 -0400 Subject: [PATCH] fixed issue with tests. ES6 classes requires class vars to be established in the constructor --- assets/js/WakaTime.js | 10 ++++++---- assets/js/components/WakaTime.react.js | 23 +++++++++++++---------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/assets/js/WakaTime.js b/assets/js/WakaTime.js index 0f2e6de..91e2889 100644 --- a/assets/js/WakaTime.js +++ b/assets/js/WakaTime.js @@ -6,13 +6,15 @@ import devtools from './libs/devtools-detect.js'; class WakaTime { - detectionIntervalInSeconds = 60; //default + constructor(props) { + this.detectionIntervalInSeconds = 60; //default - loggingType = 'domain'; //default + this.loggingType = 'domain'; //default - heartbeatApiUrl = 'https://wakatime.com/api/v1/users/current/heartbeats'; + this.heartbeatApiUrl = 'https://wakatime.com/api/v1/users/current/heartbeats'; - currentUserApiUrl = 'https://wakatime.com/api/v1/users/current'; + this.currentUserApiUrl = 'https://wakatime.com/api/v1/users/current'; + } /** * Checks if the user is logged in. diff --git a/assets/js/components/WakaTime.react.js b/assets/js/components/WakaTime.react.js index c7a6c05..5faf176 100644 --- a/assets/js/components/WakaTime.react.js +++ b/assets/js/components/WakaTime.react.js @@ -6,17 +6,20 @@ import changeExtensionIcon from '../helpers/changeExtensionIcon.js'; import WakaTimeOriginal from '../WakaTime.js'; class WakaTime extends React.Component { - logoutUserUrl = 'https://wakatime.com/logout'; - state = { - user: { - full_name: null, - email: null, - photo: null - }, - loggedIn: false, - loggingEnabled: false - }; + constructor(props) { + super(props); + this.logoutUserUrl = 'https://wakatime.com/logout'; + this.state = { + user: { + full_name: null, + email: null, + photo: null + }, + loggedIn: false, + loggingEnabled: false + } + } componentDidMount() {