forked from cujojs/curl
-
Notifications
You must be signed in to change notification settings - Fork 12
/
defineContext.html
50 lines (42 loc) · 890 Bytes
/
defineContext.html
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
49
50
<!DOCTYPE HTML>
<html>
<head>
<title>defineName/defineContext curl test file</title>
<script>
foo = {};
curl = {
defineName: 'defineModule',
defineContext: foo,
paths: {
curl: '../src/curl/'
}
};
</script>
<script src="../src/curl.js" type="text/javascript"></script>
<script type="text/javascript">
curl(['stuff/foo.defineModule']).then(
function (m) {
if (m.msg) {
write('SUCCESS: defineContext and defineName worked');
}
else {
write('FAILED: something went wrong');
}
},
function (ex) {
write('FAILED: ' + ex.message);
}
);
function write (msg) {
// hack to get the domReady! plugin to work:
define = foo.defineModule;
// now we can use domReady!:
curl('domReady!', function () {
document.body.appendChild(document.createElement('div')).innerHTML = msg;
});
}
</script>
</head>
<body>
</body>
</html>