library refactoring
This commit is contained in:
parent
47fd7856e2
commit
beb912ee83
20
lib/and.js
20
lib/and.js
@ -1,6 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
exports.and = () => {
|
module.exports = () => {
|
||||||
let state = 0; // idle
|
let state = 0; // idle
|
||||||
let total = 0;
|
let total = 0;
|
||||||
let start = 0;
|
let start = 0;
|
||||||
@ -45,21 +45,3 @@ exports.and = () => {
|
|||||||
time: () => total + start
|
time: () => total + start
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
exports.activity = skip => {
|
|
||||||
let start = 0;
|
|
||||||
let stop = 0;
|
|
||||||
return {
|
|
||||||
on: time => {
|
|
||||||
if (time > skip) {
|
|
||||||
if (start == 0) {
|
|
||||||
start = time;
|
|
||||||
} else {
|
|
||||||
stop = time;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
time: () => stop - start
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user