cabal-club / cabal-client

interface for writing peer-to-peer chat clients
GNU General Public License v3.0
95 stars 14 forks source link

Add modular event listeners #27

Closed cblgh closed 4 years ago

cblgh commented 4 years ago

this pr introduces the modular event listeners we have been craving :3

it needs better documentation and the cli has not been rewritten using only the new listeners. the old update event is still emitted, so integrating the new listeners can be done in a pieacemeal fashion.

i believe the init event will be useful for cli & desktop alike : )

debug is also introduced as a module, which allows for really nice logs of events using e.g. the following invocation

DEBUG="cabal-client" node cli.js <cabal-key> 2> cabal-debug-log.txt

see below for the list of events that are emitted, and please review to find any bugs <3

events and payloads are documented as <type>: <payload>|empty:

some renaming of emitted keys might be warranted to increase cohesion / aesthetics :~~

fixes #23

nikolaiwarner commented 4 years ago

✨✨✨✨✨✨

perguth commented 4 years ago

👍 (I like event emitters - good idea!)

cblgh commented 4 years ago

sorry for the messy diff, i reorganized some stuff which i should have probably left for a different pr

hackergrrl commented 4 years ago

Awesome!

@cblgh I noticed that the terminology for some of the fields seems to vary across the events:

It would be really nice to have consistent words for these across the event API.

cblgh commented 4 years ago

It would be really nice to have consistent words for these across the event API.

@noffle agreed! i intend to fix the naming before merging :~ thanks for listing the occurrences you found when reading through the code

cblgh commented 4 years ago

oooooookay added docs

cblgh commented 4 years ago

@nikolaiwarner any thoughts on the final review? otherwise i'll merge tomorrow morning :)

nikolaiwarner commented 4 years ago

@cblgh lgtm!

... and by that i mean this is pure 🔥🔥🔥🔥🔥

hackergrrl commented 4 years ago

:clap: