|
|
@@ -242,13 +242,15 @@ const EmitterMixin = {
|
|
|
// Save how many callbacks were added at the moment when the event has been fired.
|
|
|
const counter = eventsCounter;
|
|
|
|
|
|
+ let fireValue = null;
|
|
|
+
|
|
|
for ( let i = 0; i < callbacks.length; i++ ) {
|
|
|
// Filter out callbacks that have been added after event has been fired.
|
|
|
if ( callbacks[ i ].counter > counter ) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- callbacks[ i ].callback.apply( callbacks[ i ].ctx, args );
|
|
|
+ fireValue = callbacks[ i ].callback.apply( callbacks[ i ].ctx, args );
|
|
|
|
|
|
// Remove the callback from future requests if off() has been called.
|
|
|
if ( eventInfo.off.called ) {
|
|
|
@@ -265,6 +267,8 @@ const EmitterMixin = {
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ return fireValue;
|
|
|
}
|
|
|
};
|
|
|
|