Replaced currentTimestamp function with moment format X.
This commit is contained in:
@@ -8,7 +8,6 @@ var config = require('./../config');
|
|||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
var getDomainFromUrl = require('./../helpers/getDomainFromUrl');
|
var getDomainFromUrl = require('./../helpers/getDomainFromUrl');
|
||||||
var currentTimestamp = require('./../helpers/currentTimestamp');
|
|
||||||
var changeExtensionState = require('../helpers/changeExtensionState');
|
var changeExtensionState = require('../helpers/changeExtensionState');
|
||||||
var in_array = require('./../helpers/in_array');
|
var in_array = require('./../helpers/in_array');
|
||||||
var contains = require('./../helpers/contains');
|
var contains = require('./../helpers/contains');
|
||||||
@@ -161,7 +160,7 @@ class WakaTime {
|
|||||||
return JSON.stringify({
|
return JSON.stringify({
|
||||||
entity: entity,
|
entity: entity,
|
||||||
type: type,
|
type: type,
|
||||||
time: currentTimestamp(),
|
time: moment().format('X'),
|
||||||
is_debugging: debug
|
is_debugging: debug
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
/**
|
|
||||||
* Returns UNIX timestamp
|
|
||||||
*
|
|
||||||
* @returns {number}
|
|
||||||
*/
|
|
||||||
function currentTimestamp() {
|
|
||||||
return Math.round((new Date()).getTime() / 1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = currentTimestamp;
|
|
||||||
377
public/js/app.js
377
public/js/app.js
File diff suppressed because it is too large
Load Diff
@@ -179,7 +179,6 @@ var config = require('./../config');
|
|||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
var getDomainFromUrl = require('./../helpers/getDomainFromUrl');
|
var getDomainFromUrl = require('./../helpers/getDomainFromUrl');
|
||||||
var currentTimestamp = require('./../helpers/currentTimestamp');
|
|
||||||
var changeExtensionState = require('../helpers/changeExtensionState');
|
var changeExtensionState = require('../helpers/changeExtensionState');
|
||||||
var in_array = require('./../helpers/in_array');
|
var in_array = require('./../helpers/in_array');
|
||||||
var contains = require('./../helpers/contains');
|
var contains = require('./../helpers/contains');
|
||||||
@@ -340,7 +339,7 @@ var WakaTime = (function () {
|
|||||||
return JSON.stringify({
|
return JSON.stringify({
|
||||||
entity: entity,
|
entity: entity,
|
||||||
type: type,
|
type: type,
|
||||||
time: currentTimestamp(),
|
time: moment().format('X'),
|
||||||
is_debugging: debug
|
is_debugging: debug
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -448,7 +447,7 @@ var WakaTime = (function () {
|
|||||||
exports['default'] = WakaTime;
|
exports['default'] = WakaTime;
|
||||||
module.exports = exports['default'];
|
module.exports = exports['default'];
|
||||||
|
|
||||||
},{"../helpers/changeExtensionState":5,"./../config":2,"./../helpers/contains":7,"./../helpers/currentTimestamp":8,"./../helpers/getDomainFromUrl":9,"./../helpers/in_array":10,"jquery":11,"moment":12}],4:[function(require,module,exports){
|
},{"../helpers/changeExtensionState":5,"./../config":2,"./../helpers/contains":7,"./../helpers/getDomainFromUrl":8,"./../helpers/in_array":9,"jquery":10,"moment":11}],4:[function(require,module,exports){
|
||||||
/* global chrome */
|
/* global chrome */
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
@@ -546,7 +545,7 @@ function changeExtensionState(state) {
|
|||||||
|
|
||||||
module.exports = changeExtensionState;
|
module.exports = changeExtensionState;
|
||||||
|
|
||||||
},{"../config":2,"./changeExtensionIcon":4,"./changeExtensionTooltip":6,"./in_array":10}],6:[function(require,module,exports){
|
},{"../config":2,"./changeExtensionIcon":4,"./changeExtensionTooltip":6,"./in_array":9}],6:[function(require,module,exports){
|
||||||
/* global chrome */
|
/* global chrome */
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
@@ -587,7 +586,7 @@ function contains(line, list) {
|
|||||||
|
|
||||||
for (var i = 0; i < lines.length; i++) {
|
for (var i = 0; i < lines.length; i++) {
|
||||||
|
|
||||||
// Trim all lines from the list
|
// Trim all lines from the list one by one
|
||||||
var cleanLine = lines[i].trim();
|
var cleanLine = lines[i].trim();
|
||||||
|
|
||||||
// If by any chance one line in the list is empty, ignore it
|
// If by any chance one line in the list is empty, ignore it
|
||||||
@@ -605,20 +604,6 @@ function contains(line, list) {
|
|||||||
module.exports = contains;
|
module.exports = contains;
|
||||||
|
|
||||||
},{}],8:[function(require,module,exports){
|
},{}],8:[function(require,module,exports){
|
||||||
/**
|
|
||||||
* Returns UNIX timestamp
|
|
||||||
*
|
|
||||||
* @returns {number}
|
|
||||||
*/
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
function currentTimestamp() {
|
|
||||||
return Math.round(new Date().getTime() / 1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = currentTimestamp;
|
|
||||||
|
|
||||||
},{}],9:[function(require,module,exports){
|
|
||||||
/**
|
/**
|
||||||
* Returns domain from given URL.
|
* Returns domain from given URL.
|
||||||
*
|
*
|
||||||
@@ -635,7 +620,7 @@ function getDomainFromUrl(url) {
|
|||||||
|
|
||||||
module.exports = getDomainFromUrl;
|
module.exports = getDomainFromUrl;
|
||||||
|
|
||||||
},{}],10:[function(require,module,exports){
|
},{}],9:[function(require,module,exports){
|
||||||
/**
|
/**
|
||||||
* Returns boolean if needle is found in haystack or not.
|
* Returns boolean if needle is found in haystack or not.
|
||||||
*
|
*
|
||||||
@@ -657,7 +642,7 @@ function in_array(needle, haystack) {
|
|||||||
|
|
||||||
module.exports = in_array;
|
module.exports = in_array;
|
||||||
|
|
||||||
},{}],11:[function(require,module,exports){
|
},{}],10:[function(require,module,exports){
|
||||||
/*!
|
/*!
|
||||||
* jQuery JavaScript Library v2.1.4
|
* jQuery JavaScript Library v2.1.4
|
||||||
* http://jquery.com/
|
* http://jquery.com/
|
||||||
@@ -9869,7 +9854,7 @@ return jQuery;
|
|||||||
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
},{}],12:[function(require,module,exports){
|
},{}],11:[function(require,module,exports){
|
||||||
//! moment.js
|
//! moment.js
|
||||||
//! version : 2.10.3
|
//! version : 2.10.3
|
||||||
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
|
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
var chai = require('chai');
|
|
||||||
var expect = chai.expect;
|
|
||||||
|
|
||||||
import currentTimestamp from '../../assets/js/helpers/currentTimestamp';
|
|
||||||
|
|
||||||
describe('currentTimestamp', function() {
|
|
||||||
it('should be a function', function() {
|
|
||||||
expect(currentTimestamp).to.be.a('function');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
Reference in New Issue
Block a user