git ssb

0+

wanderer🌟 / js-primea-hypervisor



Commit cef34a0f438b2d0edde21fa2556b80abfcb81721

have the container return the intial state

Signed-off-by: wanderer <mjbecze@gmail.com>
wanderer committed on 4/25/2018, 11:48:48 PM
Parent: b9146a54337ee2e23648e5af29faaff8c1737969

Files changed

index.jschanged
tests/index.jschanged
index.jsView
@@ -76,9 +76,9 @@
7676 */
7777 createActor (type, code, id = {nonce: this.nonce++, parent: null}) {
7878 const Container = this._containerTypes[type]
7979 const actorId = generateActorId(id)
80- const module = Container.onCreation(code, actorId)
80 + const {modRef: module, state} = Container.onCreation(code, actorId)
8181 const metaData = [type, 0]
8282
8383 // save the container in the state
8484 this.tree.set(actorId.id, metaData).then(node => {
@@ -87,9 +87,9 @@
8787 '/': code
8888 }
8989 // save the storage
9090 node[2] = {
91- '/': []
91 + '/': state
9292 }
9393 })
9494
9595 return {
tests/index.jsView
@@ -17,9 +17,12 @@
1717 const exp = {}
1818 Object.getOwnPropertyNames(this.prototype).filter(name => name !== 'constructor').forEach(name => {
1919 exp[name] = {}
2020 })
21- return new ModuleRef(exp, id)
21 + return {
22 + modRef: new ModuleRef(exp, id),
23 + state: []
24 + }
2225 }
2326 onMessage (message) {
2427 return this[message.funcRef.identifier[1]](...message.funcArguments)
2528 }

Built with git-ssb-web