Skip to content

Commit

Permalink
Merge pull request #296 from ethereum/emscripten-addfunction
Browse files Browse the repository at this point in the history
Support multiple versions of Emscripten (module.Runtime.addFunction vs. module.addFunction)
  • Loading branch information
axic authored Nov 14, 2018
2 parents f617301 + 714162e commit eace963
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,21 @@ function setupMethods (soljson) {
};
};
}
var cb = soljson.Runtime.addFunction(wrapCallback(readCallback));

// This is to support multiple versions of Emscripten.
var addFunction = soljson.addFunction || soljson.Runtime.addFunction;
var removeFunction = soljson.removeFunction || soljson.Runtime.removeFunction;

var cb = addFunction(wrapCallback(readCallback));
var output;
try {
args.push(cb);
output = compile.apply(undefined, args);
} catch (e) {
soljson.Runtime.removeFunction(cb);
removeFunction(cb);
throw e;
}
soljson.Runtime.removeFunction(cb);
removeFunction(cb);
return output;
};

Expand Down

0 comments on commit eace963

Please sign in to comment.