engine.io-client
engine.io-client copied to clipboard
Use native whatwg instead?
https://github.com/socketio/engine.io-client/blob/9c79ba65f51fef44e860bbeea1626fa40c3f967c/lib/socket.js#L5-L6
How about replacing this two with just URL & URLSearchParams?
That's a good remark, thanks! I think we would need to provide a polyfill for some browsers though:
- https://caniuse.com/urlsearchparams
- https://caniuse.com/url
Which makes this change less appealing. What do you think?
Related: https://github.com/socketio/engine.io-client/issues/674
At least if they are available natively the polyfill would be GC'ed and wouldn't need to do a much JIT parsing
- Possible to conditionally import?
- Let developer decide if they wish to use a polyfill or not. Some are already dropping support for IE entirely, even microsoft themselves.
// README.md example
// Required for IE 11 support
globalThis.URL = globalThis.URL || require('url').URL
globalThis.URLSearchParams = globalThis.URLSearchParams || require('url').URLSearchParams
const engine = require('engine.io-client')
ppl could also use core-js or polyfill.io
i guess core-js is based on some browser usage config or something like that