git ssb


0+

wanderer / wasm-harness



Commit 32686fb849cb487bb18314d35f72f2a03ebe4656

readded callback to the opque

wanderer committed on 3/15/2017, 8:51:49 PM
Parent: 35239a05135f8143acb6e11bf0206fb866e94055

Files changed

index.jschanged
tests/index.jschanged
index.jsView
@@ -26,12 +26,12 @@
2626 const newInterface = new Import(opts)
2727 const props = Object.getOwnPropertyNames(Import.prototype)
2828
2929 // bind the methods to the correct 'this'
30- importMap[name] = {}
3130 for (const prop of props) {
32- importMap[name][prop] = newInterface[prop].bind(newInterface)
31+ newInterface[prop] = newInterface[prop].bind(newInterface)
3332 }
33+ importMap[name] = newInterface
3434 }
3535 return importMap
3636 }
3737
@@ -41,11 +41,11 @@
4141 vm: {
4242 /**
4343 * adds an aync operation to the operations queue
4444 */
45- pushOpsQueue: (promise, callbackIndex) => {
45+ pushOpsQueue: (promise, callbackIndex, intefaceCallback) => {
4646 this._opsQueue = Promise.all([this._opsQueue, promise]).then(values => {
47- const result = values.pop()
47+ const result = intefaceCallback(values.pop())
4848 instance.exports.callback.get(callbackIndex)(result)
4949 })
5050 },
5151 memory: () => {
tests/index.jsView
@@ -71,9 +71,9 @@
7171 async (cbOffset) {
7272 const opPromise = new Promise((resolve, reject) => {
7373 resolve()
7474 })
75- this.opts.vm.pushOpsQueue(opPromise, cbOffset)
75+ this.opts.vm.pushOpsQueue(opPromise, cbOffset, () => {})
7676 }
7777
7878 done () {
7979 t.ok(true)

Built with git-ssb-web