> For the complete documentation index, see [llms.txt](https://wirebox.ortusbooks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wirebox.ortusbooks.com/usage/wirebox-event-model/wirebox-listeners/coldbox-mode-listener.md).

# ColdBox Mode Listener

ColdBox Interceptors

![](https://content.gitbook.com/content/MtgLfPeIR8KWTwoO8bDr/blobs/jRES33oIXAAYMr2yqelL/coldBoxListener.jpg)

In ColdBox, you will create [ColdBox Interceptors](https://coldbox.ortusbooks.com/) to listen to any event in the application. Each of these methods that listen to events receive the following arguments:

<table data-header-hidden><thead><tr><th width="129.33333333333331">Argument</th><th width="191">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>Argument</strong></td><td><strong>Type</strong></td><td><strong>Description</strong></td></tr><tr><td><strong>event</strong></td><td><code>RequestContext</code></td><td>The request context of the running request</td></tr><tr><td><strong>data</strong></td><td><code>struct</code></td><td>The data structure passed in the event</td></tr><tr><td><strong>buffer</strong></td><td><code>RequestBuffer</code></td><td>A request buffer object for producing elegant content in ColdBox applications</td></tr><tr><td><strong>rc</strong></td><td><code>struct</code></td><td>Reference to the <code>rc</code> scope</td></tr><tr><td><strong>prc</strong></td><td><code>struct</code></td><td>Reference to the <code>prc</code> scope</td></tr></tbody></table>

### Example

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

{% tabs %}
{% tab title="BoxLang" %}

```js
class{

    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 );
    }
}
```

{% endtab %}

{% tab title="CFML" %}

```cfscript
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 );
    }
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://wirebox.ortusbooks.com/usage/wirebox-event-model/wirebox-listeners/coldbox-mode-listener.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
