For example, using this Methode when a Live Order is submitted, we can customize its behavior based on condition something before submitting a live order.
Supports automatically before – after triggering events for user-defined methods to support AOP similar functionality.
End-user classes like SCModel and ServiceController augments this class so they automatically trigger events for their methods.
These events will be prefixed with before: or after:, then the provided name and last the method name.
Also, listeners will receive method parameters and return value (in case of after:).
For example, we can hook to the time when an LiveOrder is submitted so we can customize its behavior like this:
Application.on('before:LiveOrder:save', function()
{
... do something before submitting a live order ...
})