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

Method context is lost when placed inside objects #188

Open
barelyhuman opened this issue Feb 5, 2023 · 0 comments
Open

Method context is lost when placed inside objects #188

barelyhuman opened this issue Feb 5, 2023 · 0 comments

Comments

@barelyhuman
Copy link

This is a this problem.

When the polka instance is placed inside an object, it looses it's own this binding.

One of my repo's handles this by taking in the contructor and binding the used methods again, but I wanted to know
if it would be possible to add them in the source itself?

Here's the file doing it for a particular use case.
https://github.com/barelyhuman/preact-ssr-starter/blob/3cb40c7eaf4bcdf985eafdd87efd0fc68e0ce767/src/lib/polka.js

I'm not sure of how often people have this usecase considering it is a micro server, but if it makes sense I don't mind raising a PR

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

No branches or pull requests

1 participant