Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup circular deps #306

Merged
merged 2 commits into from
Feb 15, 2019
Merged

Cleanup circular deps #306

merged 2 commits into from
Feb 15, 2019

Conversation

jacogr
Copy link
Member

@jacogr jacogr commented Feb 15, 2019

Fix for circular dep in paritytech/schnorrkel-js#7 (no async fix yet, up next)

@jacogr
Copy link
Member Author

jacogr commented Feb 15, 2019

Split wasm part into schnorrkel_js_wasm which is basically

module.exports = Buffer.from('...', 'base64');

Update exports in schnorrkel_js_bg to a function that takes imports as an arg

const bytes = require('./schnorrkel_js_wasm');

module.exports = function init (schnorrkel_js) {
  const imports = { './schnorrkel_js': schnorrkel_js };
  const wasmModule = new WebAssembly.Module(bytes);
  const wasmInstance = new WebAssembly.Instance(wasmModule, imports);

  return wasmInstance.exports;
};

Finally do the WASM creation in schnorrkel_js via

wasm = require('./schnorrkel_js_bg')(module.exports);

@polkadot-js-bot
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@polkadot-js polkadot-js locked as resolved and limited conversation to collaborators Jun 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants