Class: Application

'brixy.mvc.Application'~ Application

new Application (config)

Application class.
Configuration object may either be empty or may override any default application settings.

  • Dependency injection container = config.container or 'brixy.di.Container'
  • Collection of services config.services is registered in the DI container
  • Request router = config.requestRouter or 'brixy.mvc.Router'
  • Collection of routes config.routes is registered in the request router
  • Event router = config.eventRouter or 'brixy.mvc.Router'
  • Collection of events config.events is registered in the event router
Parameters:
Name Type Description
config Object

Configuration object.

Source:

Methods

getContainer () → {Object}

Returns dependency injection container.

Returns:
  • Object
Source:

getEventRouter () → {Object}

Returns event router.

Returns:
  • Object
Source:

getRequestRouter () → {Object}

Returns request router.

Returns:
  • Object
Source:

listensEvent (event) → {boolean}

Returns true if application can process the event. Only event routes, that are registered in the event router, are allowed.

Parameters:
Name Type Description
event string

Event name.

Returns:
  • boolean
Source:

processEvent (event, dataopt)

Gets event route and forwards it to processRequest() method. Only event routes, that are registered in the event router, are allowed. AppManager.processEvent() uses this method as an entry point into the application.

Parameters:
Name Type Attributes Description
event string

Event name.

data Object <optional>

Application can pass the data to the event handler. (optional)

Throws:
  • Exception

Source:

processRequest (request, senderopt)

Processes the request. Tries to convert any request to a request route.

Parameters:
Name Type Attributes Description
request string | Object

Request string or route object.

sender string | Object <optional>

Controller that sent this request. (optional)

Throws:
  • Exception

Source:

toString () → {string}

Returns a string representation of the object.

Returns:
  • string
Source: