| 79 | }, |
| 80 | // Fire callbacks |
| 81 | fire = function( context, args ) { |
| 82 | args = args || []; |
| 83 | memory = !flags.memory || [ context, args ]; |
| 84 | firing = true; |
| 85 | firingIndex = firingStart || 0; |
| 86 | firingStart = 0; |
| 87 | firingLength = list.length; |
| 88 | for ( ; list && firingIndex < firingLength; firingIndex++ ) { |
| 89 | if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) { |
| 90 | memory = true; // Mark as halted |
| 91 | break; |
| 92 | } |
| 93 | } |
| 94 | firing = false; |
| 95 | if ( list ) { |
| 96 | if ( !flags.once ) { |
| 97 | if ( stack && stack.length ) { |
| 98 | memory = stack.shift(); |
| 99 | self.fireWith( memory[ 0 ], memory[ 1 ] ); |
| 100 | } |
| 101 | } else if ( memory === true ) { |
| 102 | self.disable(); |
| 103 | } else { |
| 104 | list = []; |
| 105 | } |
| 106 | } |
| 107 | }, |
| 108 | // Actual Callbacks object |
| 109 | self = { |
| 110 | // Add a callback or a collection of callbacks to the list |