Skip to content

Commit 1910a90

Browse files
author
Artem
committed
Fix the Stripe loading
1 parent 349940e commit 1910a90

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

src/utils/browser.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import _ from 'lodash';
22

3-
export const isBrowser = () => {
3+
export function isBrowser() {
44
try {
5-
return this === window;
5+
return window;
66
} catch (e) {
77
return false;
88
}
9-
};
9+
}
1010

11-
const scriptExists = (path) => {
11+
function scriptExists(path) {
1212
const scripts = document.getElementsByTagName('script');
1313
return _.some(scripts, script => script.src === path);
14-
};
14+
}
1515

16-
export const loadScript = (path) => {
16+
export function loadScript(path) {
1717
return new Promise((resolve, reject) => {
1818
if (document === void 0 || scriptExists(path)) {
1919
return;
@@ -22,8 +22,7 @@ export const loadScript = (path) => {
2222
const script = document.createElement('script');
2323
script.onload = resolve;
2424
script.onerror = reject;
25-
2625
script.src = path;
2726
document.getElementsByTagName('head')[0].appendChild(script);
2827
});
29-
};
28+
}

0 commit comments

Comments
 (0)