Labs/Jetpack/JEP/12: Difference between revisions

 
Line 49: Line 49:
* '''callback''': Is the function to be called when a selection is made. It receives no arguments. Instead, use <code>jetpack.selection.*</code>.
* '''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:
To remove an event handler is done the normal Jetpack way:


<pre class="brush:js;toolbar:false;">jetpack.selection.onSelection.unbind( callback );</pre>


<pre class="brush:js;toolbar:false;">jetpack.selection.onSelection.unbind( callback );</pre>
''Arguments''
 
* '''callback''': A pointer to the event handler to be unbound.
 
'''Example'''
 
<pre class="brush:js;toolbar:false;">jetpack.selection.onSelection(function(){
  var html = jetpack.selection.html;
  jetpack.selection.html = ">>>" + html + "<<<";
});</pre>
577

edits