| 1064 | }, |
| 1065 | // Fire callbacks |
| 1066 | fire = function( context, args ) { |
| 1067 | args = args || []; |
| 1068 | memory = !flags.memory || [ context, args ]; |
| 1069 | fired = true; |
| 1070 | firing = true; |
| 1071 | firingIndex = firingStart || 0; |
| 1072 | firingStart = 0; |
| 1073 | firingLength = list.length; |
| 1074 | for ( ; list && firingIndex < firingLength; firingIndex++ ) { |
| 1075 | if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) { |
| 1076 | memory = true; // Mark as halted |
| 1077 | break; |
| 1078 | } |
| 1079 | } |
| 1080 | firing = false; |
| 1081 | if ( list ) { |
| 1082 | if ( !flags.once ) { |
| 1083 | if ( stack && stack.length ) { |
| 1084 | memory = stack.shift(); |
| 1085 | self.fireWith( memory[ 0 ], memory[ 1 ] ); |
| 1086 | } |
| 1087 | } else if ( memory === true ) { |
| 1088 | self.disable(); |
| 1089 | } else { |
| 1090 | list = []; |
| 1091 | } |
| 1092 | } |
| 1093 | }, |
| 1094 | // Actual Callbacks object |
| 1095 | self = { |
| 1096 | // Add a callback or a collection of callbacks to the list |