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.js | changed |
tests/index.js | changed |
index.js | ||
---|---|---|
@@ -76,9 +76,9 @@ | ||
76 | 76 … | */ |
77 | 77 … | createActor (type, code, id = {nonce: this.nonce++, parent: null}) { |
78 | 78 … | const Container = this._containerTypes[type] |
79 | 79 … | const actorId = generateActorId(id) |
80 | - const module = Container.onCreation(code, actorId) | |
80 … | + const {modRef: module, state} = Container.onCreation(code, actorId) | |
81 | 81 … | const metaData = [type, 0] |
82 | 82 … | |
83 | 83 … | // save the container in the state |
84 | 84 … | this.tree.set(actorId.id, metaData).then(node => { |
@@ -87,9 +87,9 @@ | ||
87 | 87 … | '/': code |
88 | 88 … | } |
89 | 89 … | // save the storage |
90 | 90 … | node[2] = { |
91 | - '/': [] | |
91 … | + '/': state | |
92 | 92 … | } |
93 | 93 … | }) |
94 | 94 … | |
95 | 95 … | return { |
tests/index.js | ||
---|---|---|
@@ -17,9 +17,12 @@ | ||
17 | 17 … | const exp = {} |
18 | 18 … | Object.getOwnPropertyNames(this.prototype).filter(name => name !== 'constructor').forEach(name => { |
19 | 19 … | exp[name] = {} |
20 | 20 … | }) |
21 | - return new ModuleRef(exp, id) | |
21 … | + return { | |
22 … | + modRef: new ModuleRef(exp, id), | |
23 … | + state: [] | |
24 … | + } | |
22 | 25 … | } |
23 | 26 … | onMessage (message) { |
24 | 27 … | return this[message.funcRef.identifier[1]](...message.funcArguments) |
25 | 28 … | } |
Built with git-ssb-web