CocktailJS Extensions

CocktailJS is modular from design. You can share your own extensions as Traits, Talents and even Annotations. We list here our official extensions and some little explanation of how to install and use them. For more information, please visit the github repository.

Configurable

cocktail-trait-configurable

traits talents

This extension is a Trait to include a configure method that will receive an object parameter and it will call each existent setter for each key with the corresponding value. If there is no setter for a given key, it is discarded. This is very useful for initializing objects or classes and passing a single argument into the constructor.

Read More
Github Repository

Eventable

cocktail-trait-eventable

traits talents

Eventable provides a trait to use an Emitter as a delegate. It exposes the event emitter api as part of the host class or module. It uses a given Emitter instance through a required method getEmitter to register listeners and emit events.

$ npm install cocktail-trait-eventable --save
Read More
Github Repository