forked from cujojs/wire
-
Notifications
You must be signed in to change notification settings - Fork 0
/
refs1.html
60 lines (57 loc) · 1.42 KB
/
refs1.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
51
52
53
54
55
56
57
58
59
60
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Launcher test</title>
<script src="util/doh/runner.js"></script>
<script src="test-config.js"></script>
<script type="text/javascript">
// Simple example of wiring in objects by reference using JSON ref syntax
require(['wire'], function(wire) {
wire({
plugins: [
{ module: 'wire/debug'}
],
number: 10,
name: "test3 Controller",
// Create object1, an instance of Controller, calling its constructor
// with one argument, the String "test3 Controller"
object1: {
create: {
module: "test/test1/Controller",
args: "test3 Controller"
},
// Set 2 properties on object1, number and logger. These references
// will be resolved to the actual number and logger objects. Order
// is not important in that even though logger is "declared" after object1,
// object1's logger property will be set correctly.
properties: {
number: { $ref: "number" },
logger: { $ref: "logger" }
},
// Call object1.ready("Hi!")
init: {
ready: 'Hi!'
}
},
// Create a logger object to wire into object1
logger: {
module: "test/test1/ConsoleLogger"
}
}).then(
function(context) {
context.destroy();
},
function(err) {
console.error(err);
}
);
});
</script>
</head>
<body>
<div>
<p id="node1"></p>
</div>
</body>
</html>