-
Notifications
You must be signed in to change notification settings - Fork 260
Expand file tree
/
Copy pathcallbacks.has.xml
More file actions
35 lines (30 loc) · 1.04 KB
/
callbacks.has.xml
File metadata and controls
35 lines (30 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<entry name="callbacks.has" type="method" return="Boolean">
<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></longdesc>
<example>
<desc>Using <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>