-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.txt
50 lines (41 loc) · 1.36 KB
/
README.txt
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
Smuggler.js
Rough example:
[index.html]---------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Example</title>
<script src="http://example1.com/smuggler.js?path=http://example1.com/itinerary.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
</body>
</html>
[itinerary.js]-------------------------------------------
Smuggler.fetch(
[
// Lets say we load jquery first and then some other thing....
{
source: 'http://some.place.com/where/you/find/jquery.js',
ensure: 'jQuery',
onStart: function(){
// show a loader or something
},
onFail: function(o){
// plan 9 from outter space
},
onComplete: function(){
// create our interface for our next script to put stuff in once it's loaded (or whatever)
}
},
// now we have jQuery and we are going to cornify!
{
source: 'http://www.cornify.com/js/cornify.js',
onComplete: function(){
// like I said... whatever...
cornify_add();
}
}
]
)
TODO: Come up with better docs