git ssb

0+

wanderer🌟 / js-primea-hypervisor



Commit 6723a3ab125343529593a107313cd31c8eb38d7a

save container type

wanderer committed on 7/26/2017, 5:52:43 PM
Parent: 1e3ac999b894c127c15636b20fa61d8a5e60dd0f

Files changed

index.jschanged
kernel.jschanged
package.jsonchanged
tests/index.jschanged
index.jsView
@@ -147,8 +147,9 @@
147147 * @param {Class} Constructor - a Class for instantiating the container
148148 * @param {*} args - any args that the contructor takes
149149 */
150150 registerContainer (type, Constructor, args) {
151+ Constructor.type = type
151152 this._containerTypes[type] = {
152153 Constructor: Constructor,
153154 args: args
154155 }
kernel.jsView
@@ -90,9 +90,9 @@
9090
9191 this.ports.addReceivedPorts(message)
9292 let result
9393 try {
94- result = await this.container[method](message) || {}
94+ result = await this.container[method](message)
9595 } catch (e) {
9696 result = {
9797 exception: true,
9898 exceptionError: e
package.jsonView
@@ -43,9 +43,9 @@
4343 "istanbul": "^1.1.0-alpha.1",
4444 "level-promise": "^2.1.1",
4545 "levelup": "^1.3.8",
4646 "memdown": "^1.2.4",
47- "primea-wasm-container": "0.0.0",
47+ "primea-abstract-container": "0.0.2",
4848 "standard": "10.0.2",
4949 "tape": "^4.5.1"
5050 }
5151 }
tests/index.jsView
@@ -1,29 +1,22 @@
11 const tape = require('tape')
22 const IPFS = require('ipfs')
3+const AbstractContainer = require('primea-abstract-container')
34 const Hypervisor = require('../')
45
56 // start ipfs
67 const node = new IPFS({
78 start: false
89 })
910
10-class BaseContainer {
11- constructor (kernel) {
12- this.kernel = kernel
13- }
14-
11+class BaseContainer extends AbstractContainer {
1512 initialize (message) {
1613 this.kernel.state.code = message.data.byteLength ? message.data : undefined
1714 const port = message.ports[0]
1815 if (port) {
1916 this.kernel.ports.bind('root', port)
2017 }
2118 }
22-
23- onIdle () {
24- this.kernel.shutdown()
25- }
2619 }
2720
2821 node.on('ready', () => {
2922 tape('basic', async t => {

Built with git-ssb-web