Advisable
cocktail-trait-advisable
A Trait to add AOP advices into Classes/Objects. The methods around
, after
and before
are available on host classes or objects.
Github Repository
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.
A Trait to add AOP advices into Classes/Objects. The methods around
, after
and before
are available on host classes or objects.
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 MoreThis annotation is used to apply the Eventable trait and fulfill its required method by creating a getEmitter method that returns a new Emitter instance in the current mix.
$ npm install cocktail-annotation-evented --save
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