Skip to content

Commit

Permalink
perf: declared packages side effect free and fixed existing side effe…
Browse files Browse the repository at this point in the history
…cts (#830)
  • Loading branch information
maclockard authored and FezVrasta committed Sep 17, 2019
1 parent f1f4874 commit 31102ce
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions packages/popper/package.json
Expand Up @@ -28,6 +28,7 @@
"module": "dist/esm/popper.js",
"unpkg": "dist/umd/popper.min.js",
"types": "index.d.ts",
"sideEffects": false,
"scripts": {
"prepare": "yarn build",
"postpublish": "nuget-publish && ./bower-publish.sh",
Expand Down
15 changes: 8 additions & 7 deletions packages/popper/src/utils/debounce.js
@@ -1,13 +1,14 @@
import isBrowser from './isBrowser';

const longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
let timeoutDuration = 0;
for (let i = 0; i < longerTimeoutBrowsers.length; i += 1) {
if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
timeoutDuration = 1;
break;
const timeoutDuration = (function(){
const longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
for (let i = 0; i < longerTimeoutBrowsers.length; i += 1) {
if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
return 1;
}
}
}
return 0;
}());

export function microtaskDebounce(fn) {
let called = false
Expand Down
1 change: 1 addition & 0 deletions packages/tooltip/package.json
Expand Up @@ -7,6 +7,7 @@
"module": "./dist/esm/tooltip.js",
"unpkg": "./dist/umd/tooltip.min.js",
"types": "index.d.ts",
"sideEffects": false,
"scripts": {
"build": "node bundle.js",
"prepublish": "yarn build",
Expand Down

0 comments on commit 31102ce

Please sign in to comment.