5.2.3 Configuration Options - Reference Documentation
Authors: Andres Almiray
Version: 1.2.0
5.2.3 Configuration Options
The following options are available to all MVC groups as long as you use theconfig
key.Disabling Lifecycle Events
Every MVC group triggers a few events during the span of its lifetime. These events will be sent to the event bus even if no component is interested in handling them. There may be times when you don't want these events to be placed in the event bus in order to speed up group creation/destruction. Use the following configuration to gain this effect:mvcGroups { // MVC Group for "sample" 'sample' { model = 'sample.SampleModel' view = 'sample.SampleView' controller = 'sample.SampleController' config { events { lifecycle = false } } } }
Disabling Instantiation Events
The Griffon runtime will trigger an event for every artifact it manages. As with the previous events this one will be sent to the event bus even if no component handles it. Skipping publication of this event may result in a slight increase of speed during group instantiation. Use the following configuration to gain this effect:mvcGroups { // MVC Group for "sample" 'sample' { model = 'sample.SampleModel' view = 'sample.SampleView' controller = 'sample.SampleController' config { events { instantiation = false } } } }
Disabling Destruction Events
This is the counterpart of theNewInstance
event. Skipping publication of this event may result in a slight increase of speed when a group or any artifact instance is destroyed. Use the following configuration to gain this effect:mvcGroups { // MVC Group for "sample" 'sample' { model = 'sample.SampleModel' view = 'sample.SampleView' controller = 'sample.SampleController' config { events { destruction = false } } } }
Disabling Controllers as Application Event Listeners
Controllers are registered as application event handlers by default when a group in instantiated. This makes it very convenient to have them react to events placed in the application's event bus. However you may want to avoid this automatic registration altogether, as it can lead to performance improvements. You can disable this feature with the following configuration:mvcGroups { // MVC Group for "sample" 'sample' { model = 'sample.SampleModel' view = 'sample.SampleView' controller = 'sample.SampleController' config { events { listener = false } } } }