diff options
author | Oleg Gaidarenko <markelog@gmail.com> | 2015-08-16 09:59:58 +0300 |
---|---|---|
committer | Oleg Gaidarenko <markelog@gmail.com> | 2015-09-07 20:03:50 +0300 |
commit | 10fdad742a2a6aa9f0e00b3e04fc5264797c53c7 (patch) | |
tree | 6b6d7b1375ff88f4bebbfa0703f7b595eb485df9 /src/callbacks.js | |
parent | 7aa46e0df8a673e6b00550bbbbed21eed50108b7 (diff) | |
download | jquery-10fdad742a2a6aa9f0e00b3e04fc5264797c53c7.tar.gz jquery-10fdad742a2a6aa9f0e00b3e04fc5264797c53c7.zip |
Build: Update jscs and lint files
Fixes gh-2056
Diffstat (limited to 'src/callbacks.js')
-rw-r--r-- | src/callbacks.js | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/callbacks.js b/src/callbacks.js index bec37ef54..b032c8f1c 100644 --- a/src/callbacks.js +++ b/src/callbacks.js @@ -1,4 +1,4 @@ -define([ +define( [ "./core", "./var/rnotwhite" ], function( jQuery, rnotwhite ) { @@ -8,7 +8,7 @@ function createOptions( options ) { var object = {}; jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) { object[ flag ] = true; - }); + } ); return object; } @@ -44,18 +44,25 @@ jQuery.Callbacks = function( options ) { var // Flag to know if list is currently firing firing, + // Last fire value for non-forgettable lists memory, + // Flag to know if list was already fired fired, + // Flag to prevent firing locked, + // Actual callback list list = [], + // Queue of execution data for repeatable lists queue = [], + // Index of currently firing callback (modified by add/remove as needed) firingIndex = -1, + // Fire callbacks fire = function() { @@ -114,18 +121,19 @@ jQuery.Callbacks = function( options ) { queue.push( memory ); } - (function add( args ) { + ( function add( args ) { jQuery.each( args, function( _, arg ) { if ( jQuery.isFunction( arg ) ) { if ( !options.unique || !self.has( arg ) ) { list.push( arg ); } } else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) { + // Inspect recursively add( arg ); } - }); - })( arguments ); + } ); + } )( arguments ); if ( memory && !firing ) { fire(); @@ -146,7 +154,7 @@ jQuery.Callbacks = function( options ) { firingIndex--; } } - }); + } ); return this; }, @@ -221,4 +229,4 @@ jQuery.Callbacks = function( options ) { }; return jQuery; -}); +} ); |