-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Imporve detection for Node JS (#215)
This uses `process.versions.node` to see if we are in Node.js rather than using `global.self` to check if we are in a Browser. This change also makes some minor `wasm_bindgen` improvements: - Use `js_sys::global()` to get the global object - Bind the node require as `module.require` - Improving error messages Signed-off-by: Joe Richey <[email protected]>
- Loading branch information
Showing
2 changed files
with
49 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
120a1d7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's really an insightful implementation! Never thought it's possible to do this with
Global
andextern
. 🙏If that won't bother you: am I correct that in L60
unchecked_into()
is used without any catching unwinding despite the function is fallible because the "js" feature flag kind of guarantees that theGlobal
is there one way or another?