-
-
Notifications
You must be signed in to change notification settings - Fork 73
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
Uncaught TypeError: Cannot read property 'has' of undefined #86
Comments
Removing Here is the class for reference: enum Events {
NewDataRequest = "newDataRequest"
}
export class Bus {
constructor() {
this.emitter = new Emittery()
}
emitter: Emittery
onNewDataRequest(callback: () => Promise<void>): void {
this.emitter.on(Events.NewDataRequest, callback)
}
async newDataRequest(): Promise<void> {
await this.emitter.emit(Events.NewDataRequest)
}
} |
If anyone else is looking, one solution is to use const bus = ref(new Bus())
toRaw(bus.value).emitter.on("newDataRequest", loadNewDataRequests) |
I've run into the same issue and documented what is happening here as it relates to the context I'm consuming the library in. @sindresorhus please could you take a look at this issue and see if you agree with the proposed fix? In this library I'd think that binding any member function that accesses the global maps would be necessary, rather than just the 'on' that is needed in the linked issue. If you're happy with the proposal I'm happy to take on creating a PR for this library. |
Same is happening in alpine.js which uses proxies |
My usage, I'm using
Ref
because we are using Vue in this project.loadNewDataRequests
is of signature() => Promise<void>
The text was updated successfully, but these errors were encountered: