Commit 07d52f48 by Larry Ullman

Global event benefits?

Not sure that I follow the last two paragraphs, but I may just be tired.
parent 2142bda4
......@@ -275,7 +275,7 @@ Yii::$app->trigger('bar', new Event(['sender' => new Foo]));
A benefit of using global events is that you do not need an object when attaching a handler to the event
which will be triggered by the object. Instead, the handler attachment and the event triggering are both
done through the singleton (e.g. the application instance).
done through the Singleton (e.g. the application instance).
However, because the namespace of the global events is shared by all parties, you should name the global events
wisely, such as introducing some sort of namespace (e.g. "frontend.mail.sent", "backend.mail.sent").
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment