forked from seajs/seajs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.js
49 lines (36 loc) · 984 Bytes
/
bootstrap.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/**
* The bootstrap and entrances
*/
;(function(seajs, config, global) {
var _seajs = seajs._seajs
// Avoids conflicting when sea.js is loaded multi times.
if (_seajs && !_seajs['args']) {
global.seajs = seajs._seajs
return
}
// Assigns to global define.
global.define = seajs.define
// Loads the data-main module automatically.
config.main && seajs.use(config.main)
// Parses the pre-call of seajs.config/seajs.use/define.
// Ref: test/bootstrap/async-3.html
;(function(args) {
if (args) {
var hash = {
0: 'config',
1: 'use',
2: 'define'
}
for (var i = 0; i < args.length; i += 2) {
seajs[hash[args[i]]].apply(seajs, args[i + 1])
}
}
})((_seajs || 0)['args'])
// Add define.amd property for clear indicator.
global.define.cmd = {}
// Keeps clean!
delete seajs.define
delete seajs._util
delete seajs._config
delete seajs._seajs
})(seajs, seajs._config, this)