File tree Expand file tree Collapse file tree 1 file changed +16
-15
lines changed Expand file tree Collapse file tree 1 file changed +16
-15
lines changed Original file line number Diff line number Diff line change @@ -198,7 +198,8 @@ var require;
198
198
}
199
199
200
200
if ( hangModules . length || missModules . length ) {
201
- throw new Error ( '[MODULE_TIMEOUT]Hang( '
201
+ throw new Error (
202
+ '[MODULE_TIMEOUT]Hang( '
202
203
+ ( hangModules . join ( ', ' ) || 'none' )
203
204
+ ' ) Miss( '
204
205
+ ( missModules . join ( ', ' ) || 'none' )
@@ -223,25 +224,25 @@ var require;
223
224
* @param {Array= } dependencies 依赖模块列表
224
225
* @param {Function= } factory 创建模块的工厂方法
225
226
*/
226
- function define ( ) {
227
- var argsLen = arguments . length ;
228
- if ( ! argsLen ) {
227
+ function define ( id , dependencies , factory ) {
228
+ if ( ! arguments . length ) {
229
229
return ;
230
230
}
231
231
232
- var id ;
233
- var dependencies ;
234
- var factory = arguments [ -- argsLen ] ;
235
-
236
- while ( argsLen -- ) {
237
- var arg = arguments [ argsLen ] ;
238
-
239
- if ( typeof arg === 'string' ) {
240
- id = arg ;
232
+ if ( typeof id !== 'string' ) {
233
+ if ( id instanceof Array ) {
234
+ factory = dependencies ;
235
+ dependencies = id ;
241
236
}
242
- else if ( arg instanceof Array ) {
243
- dependencies = arg ;
237
+ else {
238
+ factory = id ;
239
+ dependencies = null ;
244
240
}
241
+ id = null ;
242
+ }
243
+ else if ( ! ( dependencies instanceof Array ) ) {
244
+ factory = dependencies ;
245
+ dependencies = null ;
245
246
}
246
247
247
248
// 出现window不是疏忽
You can’t perform that action at this time.
0 commit comments