Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed a bug in .apply is not a function #93

Closed
wants to merge 9 commits into from
Closed

Fixed a bug in .apply is not a function #93

wants to merge 9 commits into from

Conversation

9ssi7
Copy link

@9ssi7 9ssi7 commented May 10, 2022

Here is the solution for issue #1532 I created for socket.io/socket.io-client. It's a very small thing. The code is really understandable. I hope you accept.

darrachequesne and others added 9 commits October 4, 2021 08:01
So that we can use `import Emitter from ...` in both CommonJS and ESM
modules.
The StrictEventEmitter class that was defined in the socket.io-client
repository ([1]) is moved here, so we don't need to create an
intermediary class (Socket > StrictEventEmitter > Emitter) to get the
proper types.

As an additional benefit, the final bundle size should be decreased.

BREAKING CHANGE: we now use a named export instead of a default export

```js
// before
import Emitter from "@socket.io/component-emitter"

// after
import { Emitter } from "@socket.io/component-emitter"
```

[1]: https://github.com/socketio/socket.io-client/blob/a9e5b85580e8edca0b0fd2850c3741d3d86a96e2/lib/typed-events.ts
@vendethiel
Copy link
Contributor

The fact socket.io registers a non-function is a bug with socket.io, not Emitter itself, which is not tied to socket.io.
I took a quick glance at the socket.io code, and the only reference to component-emitter I found was here: https://github.com/socketio/socket.io/blob/0b7d70ca42f7f3590f20ded372909a79ea270a7d/examples/custom-parsers/src/custom-parser.js#L2.

@9ssi7
Copy link
Author

9ssi7 commented May 10, 2022

The socket.io-client package includes the Emitter class from @socket.io/component-emitter. @socket.io/component-emitter is a fork from component-emitter. So the method here is internally nested with socket.io-client.

look at this

@9ssi7 9ssi7 closed this by deleting the head repository Apr 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants