Commit c377000cc6e55fdfc0f125f5b5ec17687e615dde
update example
wanderer committed on 7/5/2017, 4:34:18 PMParent: bbe2ab7645654aec34597355955371d3902cd0e0
Files changed
examples/index.js | changed |
examples/index.js | ||
---|---|---|
@@ -42,25 +42,26 @@ | ||
42 | 42 | |
43 | 43 | // create a root instance of the example container |
44 | 44 | const root = await hypervisor.createInstance('example') |
45 | 45 | |
46 | + // create two channels | |
46 | 47 | const [portRef1, portRef2] = root.ports.createChannel() |
47 | 48 | const [portRef3, portRef4] = root.ports.createChannel() |
48 | 49 | |
49 | 50 | // create two instances of the example container. These containers wiil be |
50 | 51 | // given channels to the parent container |
51 | - root.ports.create('example', root.createMessage({ | |
52 | + root.createInstance('example', root.createMessage({ | |
52 | 53 | ports: [portRef2] |
53 | 54 | })) |
54 | 55 | |
55 | - root.ports.create('example', root.createMessage({ | |
56 | + root.createInstance('example', root.createMessage({ | |
56 | 57 | ports: [portRef4] |
57 | 58 | })) |
58 | 59 | |
59 | - // bind the ports of the newly created containers. Binding ports allows the | |
60 | - // root container tot receieve messages from the containers. If no other | |
61 | - // container bound these ports then the corrisponding containers would be | |
62 | - // garbage collected | |
60 | + // bind the ports of the channels to the newly created containers. Binding | |
61 | + // ports allows the root container tt receieve messages from the containers. | |
62 | + // If no other container bound these ports then the corrisponding containers | |
63 | + // would be garbage collected | |
63 | 64 | root.ports.bind('one', portRef1) |
64 | 65 | root.ports.bind('two', portRef3) |
65 | 66 | |
66 | 67 | // create a new channel. Each channel has two corrisponding ports that |
Built with git-ssb-web