a natural language event-emitter interface.
Gordon's interface is based on the traditional event emitter, but with a few twists to support the ideas of natural language. Event names work like normal, but pennyworth templates can be associated with event names for a more natural experience.
.emit() is called with a natural language string, gordon will find the most appropriate registered
event and use its most appropriate template to parse the emitted text. The event will then be fired with
the event data being the compiled template.
initializing a new emitter
var Gordon = ;var emitter = ;
adding an event listener
For unregistered events, you can use
.when() to attach an event
handler to a trigger template.
registering an event
To register an event is to associate a certain trigger template or list of templates with an event. This allows you to hook onto a group of templates that will provide you with the same data.
On every call, you can register a single template or a list of templates. Follow up calls will not re-allocate the template list but rather append to it.
attaching to an event
This works exactly the same as with a regular event emitter.
emitting an event (using a trigger)
Call emit with a trigger, which is the input data to a pennyworth template.