ColdBox Mode Listener

ColdBox Interceptors

In ColdBox, you will create ColdBox Interceptors to listen to any event in the application. Each of these methods that listen to events receive the following arguments:

Example

So, let's say we want to listen to the beforeInjectorShutdown and the afterInstanceCreation event in our listener.

component{

    function configure(){}

    function beforeInjectorShutdown(event, data, buffer, rc, prc ){
        var injector = arguments.data.injector;
        // Do my stuff here:

        // I can use a log object because ColdBox is cool and injects one for me already.
        log.info("DUDE, I am going down!!!");
    }

    function afterInstanceCreation(event, data, buffer, rc, prc ){
        var injector = arguments.data.injector;
        var target = arguments.data.target;
        var mapping = arguments.data.mapping;

        log.info("The object #mapping.getName()# has just been built, performing my awesome AOP processing on it.");

        // process awesome AOP on this target
        processAwesomeAOP( target );
    }
}

Last updated