Skip to content

Commit 1239bb6

Browse files
committed
Added documentation to signify that listeners are called in the order they were added, see phetsims/graphing-lines#109
1 parent 20562c4 commit 1239bb6

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

js/Emitter.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ define( require => {
108108
}
109109

110110
/**
111-
* Adds a listener
111+
* Adds a listener. When emitting, the listeners are called in the order they were added.
112112
* @param {function} listener
113113
* @public
114114
*/
@@ -182,8 +182,8 @@ define( require => {
182182
}
183183

184184
/**
185-
* Emits a single event.
186-
* This method is called many times in a simulation and must be well-optimized.
185+
* Emits a single event. This method is called many times in a simulation and must be well-optimized. Listeners
186+
* are notified in the order they were added via addListener.
187187
* @params - expected parameters are based on options.argumentTypes, see constructor
188188
* @public
189189
*/

js/Property.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,8 @@ define( require => {
309309

310310
/**
311311
* Adds listener and calls it immediately. If listener is already registered, this is a no-op. The initial
312-
* notification provides the current value for newValue and null for oldValue.
312+
* notification provides the current value for newValue and null for oldValue. On value changes, listeners
313+
* are called back in the order they were added.
313314
*
314315
* @param {function} listener a function of the form listener(newValue,oldValue)
315316
* @public
@@ -320,10 +321,9 @@ define( require => {
320321
}
321322

322323
/**
323-
* Add an listener to the Property, without calling it back right away.
324-
* This is used when you need to register a listener without an immediate callback.
325-
*
326-
* @param {function} listener - a function with a single argument, which is the value of the property at the time the function is called.
324+
* Add an listener to the Property, without calling it back right away. This is used when you need to register a
325+
* listener without an immediate callback. On value changes, listeners are called back in the order they were added.
326+
* @param {function} listener - a function with a single argument, which is the current value of the Property.
327327
* @public
328328
*/
329329
lazyLink( listener ) {

0 commit comments

Comments
 (0)