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

Event handling consistency between Awareness and LoroDoc #630

Open
djrenren opened this issue Jan 27, 2025 · 0 comments
Open

Event handling consistency between Awareness and LoroDoc #630

djrenren opened this issue Jan 27, 2025 · 0 comments

Comments

@djrenren
Copy link

I just rigged these up in my application and found these two types to be confusingly different.

// LoroDoc
const unsubscribe = doc.subscribe((update) => {});
unsubscribe();

// Awareness
const listener = (update, origin) => {};
awareness.addListener(listener);
awareness.removeListener(listener);

LoroDoc returns an unsubscribe function while Awareness uses an approximation of the EventTarget interface.
In my ideal world, they'd both just use EventTarget (available in both Node and Browser), but wasm_bindgen doesn't support that so we'd have to wrap LoroDoc which is not ideal.

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