streamich / json-joy

JSON CRDT, JSON CRDT Patch, JSON Patch+, JSON Predicate, JSON Pointer, JSON Expression, JSON Type
https://jsonjoy.com/libs/json-joy-js
Apache License 2.0
743 stars 14 forks source link

Error when make patch flush in nodejs #462

Closed antablack closed 9 months ago

antablack commented 9 months ago

I am trying to run this example https://jsonjoy.com/libs/json-joy-js/json-crdt/guide/concurrent-users in nodejs v18.18.2 but, I got this error ReferenceError: CustomEvent is not defined. Screenshot 2023-11-28 at 11 03 15 AM

In nodejs is an experimental feature even for the latest version https://nodejs.org/api/events.html#class-customevent (Node.js v21.2.0). JSON-JOY version (11.5.0).

streamich commented 9 months ago

CustomEvent is available since Node.js v18.7 (maybe under flag? Definitely available in v20). But we are thinking of removing CustomEvent from json-joy in favor of FanOut, so in the coming releases this should be solved.

streamich commented 9 months ago

Also, currently the CustomEvent is used only when you use model.api on the server, if you use just model.applyPatch() the CustomEvent is not needed.

streamich commented 9 months ago

CustomEvent API has been removed.