File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import _ 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+ }
You can’t perform that action at this time.
0 commit comments