Skip to content

Commit 6df9a0a

Browse files
committed
Only import debounce function from lodash instead of the whole lib
1 parent 91585e2 commit 6df9a0a

File tree

3 files changed

+21
-33
lines changed

3 files changed

+21
-33
lines changed

package-lock.json

Lines changed: 16 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"dependencies": {
99
"express": "^4.17.1",
1010
"express-sslify": "^1.2.0",
11+
"lodash.debounce": "^4.0.8",
1112
"querystring": "^0.2.0"
1213
},
1314
"devEngines": {
@@ -70,6 +71,7 @@
7071
"scripts": {
7172
"start": "node server.js",
7273
"test": "grunt test",
74+
"test:unit": "grunt unit-tests",
7375
"build": "grunt build-website"
7476
},
7577
"heroku-run-build-script": true

src/metrics.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import log from "loglevel";
2-
import _ from "lodash";
2+
import debounce from 'lodash.debounce';
33

44

55
export function init() {
@@ -121,12 +121,12 @@ export function init() {
121121
analytics.page();
122122
}
123123

124-
export const track = _.debounce((event, data) => {
124+
export const track = debounce((event, data) => {
125125
if (window.metrics) {
126126
try {
127127
window.metrics.track(event, data);
128128
} catch (e) {
129129
log.error(`Metrics library error for event ${event}: ${e}`);
130130
}
131131
}
132-
}, 2000);
132+
}, 1000);

0 commit comments

Comments
 (0)