Labs/Jetpack/JEP/12: Difference between revisions

Line 42: Line 42:


A very common desire is to perform some sort of action when a selection is made. Often that is looking up the selection, or creating an actionable nib. <code>jetpack.selection.onSelection</code> enables Jetpack authors to easily get notified when a selection is made.
A very common desire is to perform some sort of action when a selection is made. Often that is looking up the selection, or creating an actionable nib. <code>jetpack.selection.onSelection</code> enables Jetpack authors to easily get notified when a selection is made.
<pre class="brush:js;toolbar:false;">jetpack.selection.onSelection( callback );</pre>
''Arguments''
* '''callback''': Is the function to be called when a selection is made. It receives no arguments. Instead, use <code>jetpack.selection.*</code>.
To remove an event handler is done the normal way:
<pre class="brush:js;toolbar:false;">jetpack.selection.onSelection.unbind( callback );</pre>
577

edits