jockey.js
function(type, messageId, json) {
            var self = this;

            var listenerList = this.listeners[type] || [];

            var executedCount = 0;

            var complete = function() {
                executedCount += 1;

                if (executedCount >= listenerList.length) {
                    self.dispatcher.sendCallback(messageId);
                }
            };

            for (var index = 0; index < listenerList.length; index++) {
                var listener = listenerList[index];

                // If it's a "sync" listener, we'll call the complete() function
                // after it has finished. If it's async, we expect it to call complete().
                if (listener.length <= 1) {
                    listener(json);
                    complete();
                } else {
                    listener(json, complete);
                }
            }

        }
function(type, messageId, json) {
            var self = this;

            var listenerList = this.listeners[type] || [];

            var executedCount = 0;

            var complete = function() {
                executedCount += 1;

                if (executedCount >= listenerList.length) {
                    self.dispatcher.sendCallback(messageId);
                }
            };

            for (var index = 0; index < listenerList.length; index++) {
                var listener = listenerList[index];

                // If it's a "sync" listener, we'll call the complete() function
                // after it has finished. If it's async, we expect it to call complete().
                if (listener.length <= 1) {
                    listener(json);
                    complete();
                } else {
                    listener(json, complete);
                }
            }

        }
function ( type , messageId , json ) { var self = this ; var listenerList = this . listeners [ type ] || [ ] ; var executedCount = 0 ; var complete = function ( ) { executedCount += 1 ; if ( executedCount >= listenerList . length ) { self . dispatcher . sendCallback ( messageId ) ; } } ; for ( var index = 0 ; index < listenerList . length ; index ++ ) { var listener = listenerList [ index ] ; // If it's a "sync" listener, we'll call the complete() function // after it has finished. If it's async, we expect it to call complete(). if ( listener . length <= 1 ) { listener ( json ) ; complete ( ) ; } else { listener ( json , complete ) ; } } }
Called by the native application when events are sent to JS from the app. Will execute every function, FIFO order, that was attached to this event type.
Called by the native application when events are sent to JS from the app . Will execute every function FIFO order that was attached to this event type .