koding / kite.js

Kite client in JavaScript
kite.koding.com
MIT License
75 stars 16 forks source link

tighten down event api #17

Closed humanchimp closed 10 years ago

humanchimp commented 10 years ago

Right now we're emitting rather a lot of events. I'd like to pair this down, and perhaps change the names of the events. For now we emit both connected and ready when the underlying connection is open. I think we should get rid of both of these, and replace them with a single open event. We have a similar "problem" with the disconnected event. We should rename it close. The error event is perhaps ok, except for the fact that the node EventEmitter implementation special cases this event. The user has to explicitly listen for it, or it will get converted into an "unknown, uncaught error event" or something equally useless. For this reason, it might be better to a) add a default handler for this event that does not mask the original error, or b) call the event something else, like fail or kiteError. Opening for discussion.,

humanchimp commented 10 years ago

proposed

we should have:

maybe we should have:

we should not have:

humanchimp commented 10 years ago

closing via 2717fd58a99e1fe21278eee71d4e3faea20e655f