Labs/Jetpack/JEP/28: Difference between revisions

Jump to navigation Jump to search
m
→‎Observer Callbacks: minor formatting changes
m (→‎Functions: rewording)
m (→‎Observer Callbacks: minor formatting changes)
Line 153: Line 153:
==== Observer Callbacks ====
==== Observer Callbacks ====


Observer callbacks are of the following form:
Observer callbacks are functions of the following form:


  function callback(subject, data) {
<pre class="brush:js;">
    /* ... Respond to the event notification ... */
function callback(subject, data) {
  }
  /* Respond to the event notification here... */
}
</pre>


In the above example, <tt>subject</tt> is any JavaScript object, as is <tt>data</tt>.  The particulars of what the two contain are specific to the notification topic.
In the above example, <tt>subject</tt> is any JavaScript object, as is <tt>data</tt>.  The particulars of what the two contain are specific to the notification topic.
874

edits

Navigation menu