File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change 10
10
// 只能暂时使用具名id
11
11
define ( 'js' , {
12
12
load : function ( resourceId , req , load ) {
13
+ var script = document . createElement ( 'script' ) ;
14
+ script . src = req . toUrl ( resourceId ) ;
15
+ script . async = true ;
16
+ if ( script . readyState ) {
17
+ script . onreadystatechange = onload ;
18
+ }
19
+ else {
20
+ script . onload = onload ;
21
+ }
22
+
13
23
function onload ( ) {
14
24
var readyState = script . readyState ;
15
25
if (
@@ -22,16 +32,6 @@ define('js', {
22
32
}
23
33
}
24
34
25
- var script = document . createElement ( 'script' ) ;
26
- script . src = req . toUrl ( resourceId ) ;
27
- script . async = true ;
28
- if ( script . readyState ) {
29
- script . onreadystatechange = onload ;
30
- }
31
- else {
32
- script . onload = onload ;
33
- }
34
-
35
35
var parent = document . getElementsByTagName ( 'head' ) [ 0 ]
36
36
|| document . body ;
37
37
parent . appendChild ( script ) && ( parent = null ) ;
You can’t perform that action at this time.
0 commit comments