question: void addCallback ( JSObject source , String method , JSFunction callback , boolean async ) { String key = source . toJSPointer ( ) + "." + method ; callbacks . put ( key , callback ) ; String id = JSObject . ID_KEY ; String self = source . toJSPointer ( ) ; String js = self + "." + method + "=function(){" + "var len=arguments.length;var url='/!cn1command/" + self + "." + method + "?'; " + "for (var i=0; i<len; i++){" + "var val = arguments[i]; var strval=val;" + "if ( (typeof(val) == 'object') || (typeof(val) == 'function')){ " + "var id = val." + id + "; " + "if (typeof(id)=='undefined' || typeof(" + jsLookupTable + "[id]) == 'undefined' || " + jsLookupTable + "[id]." + id + "!=id){" + jsLookupTable + ".push(val); id=" + jsLookupTable + ".indexOf(val); Object.defineProperty(val,\"" + id + "\",{value:id, enumerable:false});" + "}" + "strval='" + jsLookupTable + "['+id+']'" + "}" + "url += encodeURIComponent(typeof(val))+'='+encodeURIComponent(strval);" + "if (i < len-1){ url += '&';}" + "} window.location.href=url;" + "}" ; exec ( js , async ) ; }
target:  Adds a JSFunction to handle calls to the specified Javascript object.  This  essentially installed a Javascript proxy method that sends a message via a navigation callback to the JavascriptContext so that it can cause Java code to be executed.