Skip to content

Commit

Permalink
Added documentation to signify that listeners are called in the order…
Browse files Browse the repository at this point in the history
… they were added, see phetsims/graphing-lines#109
  • Loading branch information
samreid committed Jan 19, 2019
1 parent 20562c4 commit 1239bb6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions js/Emitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ define( require => {
}

/**
* Adds a listener
* Adds a listener. When emitting, the listeners are called in the order they were added.
* @param {function} listener
* @public
*/
Expand Down Expand Up @@ -182,8 +182,8 @@ define( require => {
}

/**
* Emits a single event.
* This method is called many times in a simulation and must be well-optimized.
* Emits a single event. This method is called many times in a simulation and must be well-optimized. Listeners
* are notified in the order they were added via addListener.
* @params - expected parameters are based on options.argumentTypes, see constructor
* @public
*/
Expand Down
10 changes: 5 additions & 5 deletions js/Property.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,8 @@ define( require => {

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

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

0 comments on commit 1239bb6

Please sign in to comment.