File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -31,14 +31,12 @@ export default class ScriptLoader {
3131 if ( ! this . _scripts [ src ] ) {
3232 this . _scripts [ src ] = new Promise ( ( resolve , reject ) => {
3333 const script = document . createElement ( 'script' ) as LegacyHTMLScriptElement ;
34- const { async = false } = options || { } ;
35- const scriptAttributes = options && options . attributes ;
34+ const { async = false , attributes = { } } = options || { } ;
3635
37- for ( const key in scriptAttributes ) {
38- if ( scriptAttributes . hasOwnProperty ( key ) ) {
39- script . setAttribute ( key , scriptAttributes [ key ] ) ;
40- }
41- }
36+ Object . keys ( attributes )
37+ . forEach ( key => {
38+ script . setAttribute ( key , attributes [ key ] ) ;
39+ } ) ;
4240
4341 script . onload = ( ) => resolve ( ) ;
4442 script . onreadystatechange = ( ) => resolve ( ) ;
You can’t perform that action at this time.
0 commit comments