You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fetch has been part of the nodejs runtime since v17.5.0 (behind an experimental flag) and v18.0.0 (without the flag) and as such is available in the "global" scope in both web and node. Furthermore, it is also available in the global scope in both deno and bun.js making it almost entirely cross runtime/environment. As such wasm-bindgen should also support fetch without referencing the window object as is shown in the docs
Proposed Solution
allowing access to the fetch method via the "global" scope in any runtime, This would be the window object for browser & the global object for nodejs. (not too sure about deno & bun.js)
Alternatives
Leave it as is and limit using fetch to only the browser
wasm-bindgen wouldn't fit the bill, this would probably belong into web-sys, but it's specifically made for Web APIs, not Node.js.
So the missing part here is probably something like node-sys, which would then be able to implement the Node.js global object and all it's methods. This can be a completely standalone library and doesn't need to live in this repository.
Considering the developer and maintenance bandwidth available, this is very much out of scope.
Motivation
fetch has been part of the nodejs runtime since v17.5.0 (behind an experimental flag) and v18.0.0 (without the flag) and as such is available in the "global" scope in both web and node. Furthermore, it is also available in the global scope in both deno and bun.js making it almost entirely cross runtime/environment. As such
wasm-bindgen
should also support fetch without referencing thewindow
object as is shown in the docsProposed Solution
allowing access to the fetch method via the "global" scope in any runtime, This would be the window object for browser & the
global
object for nodejs. (not too sure about deno & bun.js)Alternatives
Leave it as is and limit using fetch to only the browser
Additional Context
Old Outdated forum post saying it doesn't exist in node
New forum post created by me in parallel to this issue
The text was updated successfully, but these errors were encountered: