-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdavid.bootstrap.order.js
More file actions
48 lines (40 loc) · 1.36 KB
/
david.bootstrap.order.js
File metadata and controls
48 lines (40 loc) · 1.36 KB
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
/*====================================
Ordering plugin for david bootstrap.
This plugin will load any modules indicated in the order they are presented.
====================================*/
define(function(){
var m_aLoading = [];
return {
onLoaded : function (toModule)
{
// Clear out the loaded module
var lnIndex = m_aLoading.indexOf(toModule.getName());
if (lnIndex >= 0)
{
m_aLoading.splice(lnIndex,1);
}
// Load the next one
if (m_aLoading.length > 0)
{
var loModule = david.Bootstrap.getModule(m_aLoading[0]);
loModule.plugin.load(loModule);
}
},
load : function (toModule)
{
// If the module is already loaded then there is nothing to do
if (!toModule.isLoading() && !toModule.isCompleted())
{
if (m_aLoading.indexOf(toModule.getName()) < 0)
{
m_aLoading.push(toModule.getName());
}
// If this is the top module on the list, start to load it
if (m_aLoading[0] === toModule.getName())
{
toModule.load();
}
}
}
};
}, true);