Skip to content

Commit 9d06221

Browse files
committed
More tweaks to EventDispatcher on/off docs.
Signed-off-by: Grant Skinner <info@gskinner.com>
1 parent a4e22ad commit 9d06221

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/createjs/events/EventDispatcher.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,11 @@ this.createjs = this.createjs||{};
184184
* only run once, associate arbitrary data with the listener, and remove the listener.
185185
*
186186
* This method works by creating an anonymous wrapper function and subscribing it with addEventListener.
187-
* The created anonymous function is returned for use with .removeEventListener (or .off).
188-
* <b>To remove a listener added with `on`, you must pass in the returned wrapper function as the listener, or use
189-
* {{#crossLink "Event/remove"}}{{/crossLink}}</b>
187+
* The wrapper function is returned for use with `removeEventListener` (or `off`).
188+
*
189+
* <b>IMPORTANT:</b> To remove a listener added with `on`, you must pass in the returned wrapper function as the listener, or use
190+
* {{#crossLink "Event/remove"}}{{/crossLink}}. Likewise, each time you call `on` a NEW wrapper function is subscribed, so multiple calls
191+
* to `on` with the same params will create multiple listeners.
190192
*
191193
* <h4>Example</h4>
192194
*
@@ -257,8 +259,8 @@ this.createjs = this.createjs||{};
257259
* A shortcut to the removeEventListener method, with the same parameters and return value. This is a companion to the
258260
* .on method.
259261
*
260-
* <b>To remove a listener added with `on`, you must pass in the returned wrapper function as the listener. See
261-
* {{#crossLink "EventDispatcher/on"}}{{/crossLink}} for an example.</b>
262+
* <b>IMPORTANT:</b> To remove a listener added with `on`, you must pass in the returned wrapper function as the listener. See
263+
* {{#crossLink "EventDispatcher/on"}}{{/crossLink}} for an example.
262264
*
263265
* @method off
264266
* @param {String} type The string type of the event.

0 commit comments

Comments
 (0)