Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

40 lines (34 sloc) 1.121 kB
<?xml version="1.0"?>
<entry name="callbacks.has" type="method" return="Boolean">
<title>callbacks.has()</title>
<signature>
<added>1.7</added>
<argument name="callback" type="Function">
<desc>The callback to search for.</desc>
</argument>
</signature>
<desc>Determine whether a supplied callback is in a list</desc>
<longdesc/>
<example>
<desc>Use <code>callbacks.has()</code> to check if a callback list contains a specific callback:</desc>
<code><![CDATA[// a sample logging function to be added to a callbacks list
var foo = function( value1, value2 ) {
console.log( "Received: " + value1 + "," + value2 );
};
// a second function which will not be added to the list
var bar = function( value1, value2 ) {
console.log( "foobar" );
}
var callbacks = $.Callbacks();
// add the log method to the callbacks list
callbacks.add( foo );
// determine which callbacks are in the list
console.log( callbacks.has( foo ) );
// true
console.log( callbacks.has( bar ) );
// false
]]></code>
</example>
<category slug="callbacks-object"/>
<category slug="version/1.7"/>
</entry>
Jump to Line
Something went wrong with that request. Please try again.