jockey.js
function(type, envelope, complete) {
            // We send the message by navigating the browser to a special URL.
            // The iOS library will catch the navigation, prevent the UIWebView
            // from continuing, and use the data in the URL to execute code
            // within the iOS app.

            var dispatcher = this;

            this.callbacks[envelope.id] = function() {
                complete();

                delete dispatcher.callbacks[envelope.id];
            };

	    var src = "jockey://" + type + "/" + envelope.id + "?" + encodeURIComponent(JSON.stringify(envelope));
            var iframe = document.createElement("iframe"); 
            iframe.setAttribute("src", src); 
            document.documentElement.appendChild(iframe); 
            iframe.parentNode.removeChild(iframe); 
            iframe = null; 
	  }
function(type, envelope, complete) {
            // We send the message by navigating the browser to a special URL.
            // The iOS library will catch the navigation, prevent the UIWebView
            // from continuing, and use the data in the URL to execute code
            // within the iOS app.

            var dispatcher = this;

            this.callbacks[envelope.id] = function() {
                complete();

                delete dispatcher.callbacks[envelope.id];
            };

	    var src = "jockey://" + type + "/" + envelope.id + "?" + encodeURIComponent(JSON.stringify(envelope));
            var iframe = document.createElement("iframe"); 
            iframe.setAttribute("src", src); 
            document.documentElement.appendChild(iframe); 
            iframe.parentNode.removeChild(iframe); 
            iframe = null; 
	  }
function ( type , envelope , complete ) { // We send the message by navigating the browser to a special URL. // The iOS library will catch the navigation, prevent the UIWebView // from continuing, and use the data in the URL to execute code // within the iOS app. var dispatcher = this ; this . callbacks [ envelope . id ] = function ( ) { complete ( ) ; delete dispatcher . callbacks [ envelope . id ] ; } ; var src = "jockey://" + type + "/" + envelope . id + "?" + encodeURIComponent ( JSON . stringify ( envelope ) ) ; var iframe = document . createElement ( "iframe" ) ; iframe . setAttribute ( "src" , src ) ; document . documentElement . appendChild ( iframe ) ; iframe . parentNode . removeChild ( iframe ) ; iframe = null ; }
`type` can either be "event" or "callback"
type can either be event or callback