Skip to content

Commit

Permalink
cache temporary link for url resolution (#8035)
Browse files Browse the repository at this point in the history
  • Loading branch information
mourner authored Mar 14, 2019
1 parent ceeb899 commit 6e50e15
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/util/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ const cancel = window.cancelAnimationFrame ||
window.webkitCancelAnimationFrame ||
window.msCancelAnimationFrame;

let linkEl;

/**
* @private
*/
Expand Down Expand Up @@ -45,9 +47,9 @@ const exported = {
},

resolveURL(path: string) {
const a = window.document.createElement('a');
a.href = path;
return a.href;
if (!linkEl) linkEl = window.document.createElement('a');
linkEl.href = path;
return linkEl.href;
},

hardwareConcurrency: window.navigator.hardwareConcurrency || 4,
Expand Down

0 comments on commit 6e50e15

Please sign in to comment.