Richie Bendall

Results 140 comments of Richie Bendall

> But how about `init`/`deinit` 👍

If this is already done in browsers, it makes sense to also implement it here.

Can't it be done like this? ```js globalThis.fetch ||= (await import('node-fetch')).default ```

Can't it be done like this? ```js // lazy conditional import if (!globalThis.fetch) { const {default: fetch, Headers, Request, Response} = await import('node-fetch'); globalThis.fetch ||= fetch; globalThis.Headers ||= Headers; globalThis.Request...

@jimmywarting By nesting it in an if statement, are we confident that the subclasses won't be missed out?

@bitinn I think we should use `http2-wrapper` since we don't want to be maintaining the solution to problems that have already been solved.

If all goes to plan, `node-fetch` will no longer be needed by 30/04/2024, the date when Node.js v16 is EOL. Until then, we'd want to backport whatever v18 does to...

@sindresorhus The problem involves the asynchronous nature of promises. They are only executed during idle time which is why https://github.com/sindresorhus/make-synchronous/issues/3 is impossible (since synchronously sleeping is not counted as idle)....

After some additional investigation, it appears that the only way to fix this problem is to wait for `.emit` to resolve by awaiting it here: https://github.com/sindresorhus/emittery/blob/1afed6ab1f8b22a6fa36448a23ea3b829431b5f9/index.js#L207 and here: https://github.com/sindresorhus/emittery/blob/1afed6ab1f8b22a6fa36448a23ea3b829431b5f9/index.js#L223 However,...