WildcatIP / other.js

The Chatternet feature platform
GNU Affero General Public License v3.0
7 stars 1 forks source link

A Listener should track its own events #125

Open kharmabum opened 7 years ago

kharmabum commented 7 years ago

Presently the Listener class assumes all types of listeners are interested in ACTIVATE_CHAT_COMPLETE_RESULT and SET_STAGED_MESSAGE and provides stub methods to handle each. The proposal here is to make Listener agnostic to which events it listens to. A listener should maintain a list of events (set on initialization) and, when prompted, begin listening on the appropriate emitter (specified by the event). The base Listener class can provide a single handleEvent() method which can then be overridden by subclasses.

If accepted, this would block https://github.com/other-xyz/other.js/issues/122 as message actions (text results) would be provided by a SelectedMessageListener class.

cc @tonygentilcore

kharmabum commented 7 years ago

In this world, Command/Mention/TokenListener would become subclasses of a new type, e.g. StagedMessageListener.