Skip to content

Commit cd94e78

Browse files
committed
Edits for style and consistency. Mostly callbacks entries
1 parent c8e42e3 commit cd94e78

12 files changed

+171
-117
lines changed

Diff for: entries/callbacks.add.xml

+16-17
Original file line numberDiff line numberDiff line change
@@ -3,45 +3,44 @@
33
<title>callbacks.add()</title>
44
<signature>
55
<added>1.7</added>
6-
<argument name="callbacks" type="Function">
6+
<argument name="callbacks" type="Function, Array">
77
<desc>A function, or array of functions, that are to be added to the callback list.</desc>
88
</argument>
99
</signature>
1010
<desc>Add a callback or a collection of callbacks to a callback list.</desc>
1111
<longdesc>
1212
<p>This method returns the Callbacks object onto which it is attached (<code>this</code>). </p>
1313
<h2 id="example-1">Example</h2>
14-
<p>Using <code>callbacks.add()</code> to add new callbacks to a callback list:</p>
15-
<pre><code>
16-
// a sample logging function to be added to a callbacks list
17-
var foo = function( value ){
18-
console.log( 'foo:' + value );
19-
}
14+
<p>Use <code>callbacks.add()</code> to add new callbacks to a callback list:</p>
15+
<pre><code><![CDATA[// a sample logging function to be added to a callbacks list
16+
var foo = function( value ) {
17+
console.log( "foo: " + value );
18+
};
2019
2120
// another function to also be added to the list
2221
var bar = function( value ){
23-
console.log( 'bar:' + value );
24-
}
22+
console.log( "bar: " + value );
23+
};
2524
2625
var callbacks = $.Callbacks();
2726
28-
// add the function 'foo' to the list
27+
// add the function "foo" to the list
2928
callbacks.add( foo );
3029
3130
// fire the items on the list
32-
callbacks.fire( 'hello' );
33-
// outputs: 'foo: hello'
31+
callbacks.fire( "hello" );
32+
// outputs: "foo: hello"
3433
35-
// add the function 'bar' to the list
34+
// add the function "bar" to the list
3635
callbacks.add( bar );
3736
3837
// fire the items on the list again
39-
callbacks.fire( 'world' );
38+
callbacks.fire( "world" );
4039
4140
// outputs:
42-
// 'foo: world'
43-
// 'bar: world'
44-
</code>
41+
// "foo: world"
42+
// "bar: world"
43+
]]></code>
4544
</pre>
4645
</longdesc>
4746
<category slug="callbacks-object"/>

Diff for: entries/callbacks.disable.xml

+11-10
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,28 @@
88
<longdesc>
99
<p>This method returns the Callbacks object onto which it is attached (<code>this</code>). </p>
1010
<h2 id="example-1">Example</h2>
11-
<p>Using <code>callbacks.disable()</code> to disable further calls being made to a callback list:</p>
12-
<pre><code>
13-
// a sample logging function to be added to a callbacks list
14-
var foo = function( value ){
15-
console.log( value );
16-
}
11+
<p>Use <code>callbacks.disable()</code> to disable further calls to a callback list:</p>
12+
<pre><code><![CDATA[// a sample logging function to be added to a callbacks list
13+
var foo = function( value ) {
14+
console.log( value );
15+
};
1716
1817
var callbacks = $.Callbacks();
1918
2019
// add the above function to the list
2120
callbacks.add( foo );
2221
2322
// fire the items on the list
24-
callbacks.fire( 'foo' ); // outputs: foo
23+
callbacks.fire( "foo" );
24+
// outputs: foo
2525
2626
// disable further calls being possible
2727
callbacks.disable();
2828
29-
// attempt to fire with 'foobar' as an argument
30-
callbacks.fire( 'foobar' ); // foobar isn't output
31-
</code></pre>
29+
// attempt to fire with "foobar" as an argument
30+
callbacks.fire( "foobar" );
31+
// foobar isn't output
32+
]]></code></pre>
3233
</longdesc>
3334
<category slug="callbacks-object"/>
3435
<category slug="version/1.7"/>

Diff for: entries/callbacks.empty.xml

+10-9
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,15 @@
88
<longdesc>
99
<p>This method returns the Callbacks object onto which it is attached (<code>this</code>). </p>
1010
<h2 id="example-1">Example</h2>
11-
<p>Using <code>callbacks.empty()</code> to empty a list of callbacks:</p>
12-
<pre><code>
13-
// a sample logging function to be added to a callbacks list
14-
var foo = function( value1, value2 ){
15-
console.log( 'foo:' + value1 + ',' + value2 );
11+
<p>Use <code>callbacks.empty()</code> to empty a list of callbacks:</p>
12+
<pre><code><![CDATA[// a sample logging function to be added to a callbacks list
13+
var foo = function( value1, value2 ) {
14+
console.log( "foo: " + value1 + "," + value2 );
1615
}
1716
1817
// another function to also be added to the list
1918
var bar = function( value1, value2 ){
20-
console.log( 'bar:' + value1 + ',' + value2 );
19+
console.log( "bar: " + value1 + "," + value2 );
2120
}
2221
2322
var callbacks = $.Callbacks();
@@ -30,9 +29,11 @@ callbacks.add( bar );
3029
callbacks.empty();
3130
3231
// check to ensure all callbacks have been removed
33-
console.log( callbacks.has( foo ) ); // false
34-
console.log( callbacks.has( bar ) ); // false
35-
</code></pre>
32+
console.log( callbacks.has( foo ) );
33+
// false
34+
console.log( callbacks.has( bar ) );
35+
// false
36+
]]></code></pre>
3637
</longdesc>
3738
<category slug="callbacks-object"/>
3839
<category slug="version/1.7"/>

Diff for: entries/callbacks.fire.xml

+13-13
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,44 @@
33
<title>callbacks.fire()</title>
44
<signature>
55
<added>1.7</added>
6-
<argument name="arguments" type="">
6+
<argument name="arguments" type="Anything">
77
<desc>The argument or list of arguments to pass back to the callback list.</desc>
88
</argument>
99
</signature>
1010
<desc>Call all of the callbacks with the given arguments</desc>
1111
<longdesc>
1212
<p>This method returns the Callbacks object onto which it is attached (<code>this</code>). </p>
1313
<h2 id="example-1">Example</h2>
14-
<p>Using <code>callbacks.fire()</code> to invoke the callbacks in a list with any arguments that have been passed:</p>
15-
<pre><code>
14+
<p>Use <code>callbacks.fire()</code> to invoke the callbacks in a list with any arguments that have been passed:</p>
15+
<pre><code><![CDATA[
1616
// a sample logging function to be added to a callbacks list
17-
var foo = function( value ){
18-
console.log( 'foo:' + value );
17+
var foo = function( value ) {
18+
console.log( "foo:" + value );
1919
}
2020
2121
var callbacks = $.Callbacks();
2222
23-
// add the function 'foo' to the list
23+
// add the function "foo" to the list
2424
callbacks.add( foo );
2525
2626
// fire the items on the list
27-
callbacks.fire( 'hello' ); // outputs: 'foo: hello'
28-
callbacks.fire( 'world '); // outputs: 'foo: world'
27+
callbacks.fire( "hello" ); // outputs: "foo: hello"
28+
callbacks.fire( "world" ); // outputs: "foo: world"
2929
3030
// add another function to the list
3131
var bar = function( value ){
32-
console.log( 'bar:' + value );
32+
console.log( "bar:" + value );
3333
}
3434
3535
// add this function to the list
3636
callbacks.add( bar );
3737
3838
// fire the items on the list again
39-
callbacks.fire( 'hello again' );
39+
callbacks.fire( "hello again" );
4040
// outputs:
41-
// 'foo: hello again'
42-
// 'bar: hello again'
43-
</code></pre>
41+
// "foo: hello again"
42+
// "bar: hello again"
43+
]]></code></pre>
4444
</longdesc>
4545
<category slug="callbacks-object"/>
4646
<category slug="version/1.7"/>

Diff for: entries/callbacks.fireWith.xml

+9-10
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,24 @@
1414
<longdesc>
1515
<p>This method returns the Callbacks object onto which it is attached (<code>this</code>). </p>
1616
<h2 id="example-1">Example</h2>
17-
<p>Using <code>callbacks.fireWith()</code> to fire a list of callbacks with a specific context and an array of arguments:</p>
18-
<pre><code>
19-
// a sample logging function to be added to a callbacks list
20-
var log = function( value1, value2 ){
21-
console.log( 'Received:' + value1 + ',' + value2 );
22-
}
17+
<p>Use <code>callbacks.fireWith()</code> to fire a list of callbacks with a specific context and an array of arguments:</p>
18+
<pre><code><![CDATA[// a sample logging function to be added to a callbacks list
19+
var log = function( value1, value2 ) {
20+
console.log( "Received: " + value1 + "," + value2 );
21+
};
2322
2423
var callbacks = $.Callbacks();
2524
2625
// add the log method to the callbacks list
2726
callbacks.add( log );
2827
29-
// fire the callbacks on the list using the context 'window'
28+
// fire the callbacks on the list using the context "window"
3029
// and an arguments array
3130
32-
callbacks.fireWith( window, ['foo','bar']);
31+
callbacks.fireWith( window, ["foo","bar"]);
3332
34-
// outputs: Received: foo, bar
35-
</code></pre>
33+
// outputs: "Received: foo, bar"
34+
]]></code></pre>
3635
</longdesc>
3736
<category slug="callbacks-object"/>
3837
<category slug="version/1.7"/>

Diff for: entries/callbacks.fired.xml

+10-11
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,25 @@
77
<desc>Determine if the callbacks have already been called at least once.</desc>
88
<longdesc>
99
<h2 id="example-1">Example</h2>
10-
<p>Using <code>callbacks.fired()</code> to determine if the callbacks in a list have been called at least once:</p>
11-
<pre><code>
12-
// a sample logging function to be added to a callbacks list
13-
var foo = function( value ){
14-
console.log( 'foo:' + value );
15-
}
10+
<p>Use <code>callbacks.fired()</code> to determine if the callbacks in a list have been called at least once:</p>
11+
<pre><code><![CDATA[// a sample logging function to be added to a callbacks list
12+
var foo = function( value ) {
13+
console.log( "foo:" + value );
14+
};
1615
1716
var callbacks = $.Callbacks();
1817
19-
// add the function 'foo' to the list
18+
// add the function "foo" to the list
2019
callbacks.add( foo );
2120
2221
// fire the items on the list
23-
callbacks.fire( 'hello' ); // outputs: 'foo: hello'
24-
callbacks.fire( 'world '); // outputs: 'foo: world'
22+
callbacks.fire( "hello" ); // outputs: "foo: hello"
23+
callbacks.fire( "world" ); // outputs: "foo: world"
2524
2625
// test to establish if the callbacks have been called
2726
console.log( callbacks.fired() );
28-
</code></pre>
27+
]]></code></pre>
2928
</longdesc>
3029
<category slug="callbacks-object"/>
3130
<category slug="version/1.7"/>
32-
</entry>
31+
</entry>

Diff for: entries/callbacks.has.xml

+11-9
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
<desc>Determine whether a supplied callback is in a list</desc>
1111
<longdesc/>
1212
<example>
13-
<desc>Using <code>callbacks.has()</code> to check if a callback list contains a specific callback:</desc>
13+
<desc>Use <code>callbacks.has()</code> to check if a callback list contains a specific callback:</desc>
1414
<code><![CDATA[// a sample logging function to be added to a callbacks list
15-
var foo = function( value1, value2 ){
16-
console.log( 'Received:' + value1 + ',' + value2 );
17-
}
15+
var foo = function( value1, value2 ) {
16+
console.log( "Received: " + value1 + "," + value2 );
17+
};
1818
1919
// a second function which will not be added to the list
20-
var bar = function( value1, value2 ){
21-
console.log( 'foobar');
20+
var bar = function( value1, value2 ) {
21+
console.log( "foobar" );
2222
}
2323
2424
var callbacks = $.Callbacks();
@@ -28,10 +28,12 @@ callbacks.add( foo );
2828
2929
// determine which callbacks are in the list
3030
31-
console.log( callbacks.has( foo ) ); // true
32-
console.log( callbacks.has( bar ) ); // false
31+
console.log( callbacks.has( foo ) );
32+
// true
33+
console.log( callbacks.has( bar ) );
34+
// false
3335
]]></code>
3436
</example>
3537
<category slug="callbacks-object"/>
3638
<category slug="version/1.7"/>
37-
</entry>
39+
</entry>

0 commit comments

Comments
 (0)