vendor/opentok.js
function executeListenersAsyncronously(name, args, defaultAction) {
        var listeners = api.events[name];
        if (!listeners || listeners.length === 0) return;

        var listenerAcks = listeners.length;

        $.forEach(listeners, function(listener) { // , index
          function filterHandlers(_listener) {
            return _listener.handler === listener.handler;
          }

          // We run this asynchronously so that it doesn't interfere with execution if an
          // error happens
          $.callAsync(function() {
            try {
              // have to check if the listener has not been removed
              if (api.events[name] && $.some(api.events[name], filterHandlers)) {
                (listener.closure || listener.handler).apply(listener.context || null, args);
              }
            }
            finally {
              listenerAcks--;

              if (listenerAcks === 0) {
                executeDefaultAction(defaultAction, args);
              }
            }
          });
        });
      }
function executeListenersAsyncronously(name, args, defaultAction) {
        var listeners = api.events[name];
        if (!listeners || listeners.length === 0) return;

        var listenerAcks = listeners.length;

        $.forEach(listeners, function(listener) { // , index
          function filterHandlers(_listener) {
            return _listener.handler === listener.handler;
          }

          // We run this asynchronously so that it doesn't interfere with execution if an
          // error happens
          $.callAsync(function() {
            try {
              // have to check if the listener has not been removed
              if (api.events[name] && $.some(api.events[name], filterHandlers)) {
                (listener.closure || listener.handler).apply(listener.context || null, args);
              }
            }
            finally {
              listenerAcks--;

              if (listenerAcks === 0) {
                executeDefaultAction(defaultAction, args);
              }
            }
          });
        });
      }
function executeListenersAsyncronously ( name , args , defaultAction ) { var listeners = api . events [ name ] ; if ( ! listeners || listeners . length === 0 ) return ; var listenerAcks = listeners . length ; $ . forEach ( listeners , function ( listener ) { // , index function filterHandlers ( _listener ) { return _listener . handler === listener . handler ; } // We run this asynchronously so that it doesn't interfere with execution if an // error happens $ . callAsync ( function ( ) { try { // have to check if the listener has not been removed if ( api . events [ name ] && $ . some ( api . events [ name ] , filterHandlers ) ) { ( listener . closure || listener . handler ) . apply ( listener . context || null , args ) ; } } finally { listenerAcks -- ; if ( listenerAcks === 0 ) { executeDefaultAction ( defaultAction , args ) ; } } } ) ; } ) ; }
Execute each handler in +listeners+ with +args+.  Each handler will be executed async. On completion the defaultAction handler will be executed with the args.  @param [Array] listeners An array of functions to execute. Each will be passed args.  @param [Array] args An array of arguments to execute each function in  +listeners+ with.  @param [String] name The name of this event.  @param [Function, Null, Undefined] defaultAction An optional function to execute after every other handler. This will execute even if +listeners+ is empty. +defaultAction+ will be passed args as a normal handler would.  @return Undefined
Execute each handler in + listeners + with + args + . Each handler will be executed async . On completion the defaultAction handler will be executed with the args .