Don't use relative AMD module paths and make explicit bigint's dependency on crypto. #36
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi @arlolra
Thank you for this excellent library. I'm using it to provide OTR functionality in converse.js.
I would appreciate it if you mentioned converse.js under the list of programs using OTR.js
This pull request contains two changes.
This is the most important change for me. I'm using PhantomJS/Jasmine for tests and without this change they break because root.crypto is undefined.
I'm not an AMD/require.js expert but it appears to me that using relative paths to AMD modules in the define call is an anti-pattern.
The reason for this is that converse.js is now forced to include OTR.js also via a relative path and this makes it difficult for consumers of converse.js to integrate it into their AMD/require.js projects, because they now need to maintain the same filesystem layout expected by both converse.js and OTR.js.
Instead, how I think it needs to be done is that require.js's config option must be used to configure the relative paths, and then in the define call only the module name is used. Here is for example how converse.js configures the paths: https://github.com/jcbrand/converse.js/blob/master/main.js
Link to require.js's docs on config: http://requirejs.org/docs/api.html#config
The require.js config call is separate from any modules and is project specific. This means that integrators can configure the paths specifically for their own project and don't need to maintain a specific filesystem structure.
Thanks
JC