31 lines
554 B
Plaintext
31 lines
554 B
Plaintext
A listener can be attached to an object only after it has been constructed. So dispatching an event in a constructor is useless and error prone.
|
|
|
|
|
|
== Noncompliant Code Example
|
|
|
|
----
|
|
public class MyClass
|
|
{
|
|
public function MyClass()
|
|
{
|
|
dispatchEvent( new Event( "uselessEvent" ) );
|
|
}
|
|
}
|
|
----
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::message.adoc[]
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::comments-and-links.adoc[]
|
|
endif::env-github,rspecator-view[]
|