git ssb

0+

wanderer🌟 / js-primea-hypervisor



Commit c377000cc6e55fdfc0f125f5b5ec17687e615dde

update example

wanderer committed on 7/5/2017, 4:34:18 PM
Parent: bbe2ab7645654aec34597355955371d3902cd0e0

Files changed

examples/index.jschanged
examples/index.jsView
@@ -42,25 +42,26 @@
4242
4343 // create a root instance of the example container
4444 const root = await hypervisor.createInstance('example')
4545
46+ // create two channels
4647 const [portRef1, portRef2] = root.ports.createChannel()
4748 const [portRef3, portRef4] = root.ports.createChannel()
4849
4950 // create two instances of the example container. These containers wiil be
5051 // given channels to the parent container
51- root.ports.create('example', root.createMessage({
52+ root.createInstance('example', root.createMessage({
5253 ports: [portRef2]
5354 }))
5455
55- root.ports.create('example', root.createMessage({
56+ root.createInstance('example', root.createMessage({
5657 ports: [portRef4]
5758 }))
5859
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
6364 root.ports.bind('one', portRef1)
6465 root.ports.bind('two', portRef3)
6566
6667 // create a new channel. Each channel has two corrisponding ports that

Built with git-ssb-web