Pass url and project as an object
This commit is contained in:
@@ -80,7 +80,6 @@ class WakaTimeCore {
|
|||||||
* and sends it to WakaTime for logging.
|
* and sends it to WakaTime for logging.
|
||||||
*/
|
*/
|
||||||
recordHeartbeat() {
|
recordHeartbeat() {
|
||||||
|
|
||||||
chrome.storage.sync.get({
|
chrome.storage.sync.get({
|
||||||
loggingEnabled: config.loggingEnabled,
|
loggingEnabled: config.loggingEnabled,
|
||||||
loggingStyle: config.loggingStyle,
|
loggingStyle: config.loggingStyle,
|
||||||
@@ -88,24 +87,28 @@ class WakaTimeCore {
|
|||||||
whitelist: ''
|
whitelist: ''
|
||||||
}, (items) => {
|
}, (items) => {
|
||||||
if (items.loggingEnabled === true) {
|
if (items.loggingEnabled === true) {
|
||||||
|
|
||||||
changeExtensionState('allGood');
|
changeExtensionState('allGood');
|
||||||
|
|
||||||
chrome.idle.queryState(config.detectionIntervalInSeconds, (newState) => {
|
chrome.idle.queryState(config.detectionIntervalInSeconds, (newState) => {
|
||||||
|
|
||||||
if (newState === 'active') {
|
if (newState === 'active') {
|
||||||
// Get current tab URL.
|
// Get current tab URL.
|
||||||
chrome.tabs.query({active: true}, (tabs) => {
|
chrome.tabs.query({active: true}, (tabs) => {
|
||||||
|
|
||||||
var currentActiveTab = tabs[0];
|
var currentActiveTab = tabs[0];
|
||||||
|
var debug = false, entity;
|
||||||
|
|
||||||
var debug = false;
|
|
||||||
// If the current active tab has devtools open
|
// If the current active tab has devtools open
|
||||||
if (in_array(currentActiveTab.id, this.tabsWithDevtoolsOpen)) debug = true;
|
if (in_array(currentActiveTab.id, this.tabsWithDevtoolsOpen)) {
|
||||||
|
debug = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (items.loggingStyle == 'blacklist') {
|
if (items.loggingStyle == 'blacklist') {
|
||||||
if (! contains(currentActiveTab.url, items.blacklist)) {
|
entity = this.checkURL(currentActiveTab.url, items.blacklist);
|
||||||
this.sendHeartbeat(currentActiveTab.url, debug);
|
if (! entity.url) {
|
||||||
|
this.sendHeartbeat({
|
||||||
|
url: currentActiveTab.url,
|
||||||
|
project: false
|
||||||
|
}, debug);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
changeExtensionState('blacklisted');
|
changeExtensionState('blacklisted');
|
||||||
@@ -114,8 +117,9 @@ class WakaTimeCore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (items.loggingStyle == 'whitelist') {
|
if (items.loggingStyle == 'whitelist') {
|
||||||
if (contains(currentActiveTab.url, items.whitelist)) {
|
entity = this.checkURL(currentActiveTab.url, items.whitelist);
|
||||||
this.sendHeartbeat(currentActiveTab.url, debug);
|
if (entity.url) {
|
||||||
|
this.sendHeartbeat(entity, debug);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
changeExtensionState('whitelisted');
|
changeExtensionState('whitelisted');
|
||||||
|
|||||||
Reference in New Issue
Block a user