Created
November 4, 2009 21:59
-
-
Save chrisforbes/226423 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// c# / xulrunner host call interface [for geckofx-1.9, xulrunner-1.9.1.3] | |
// allows arb. calls to window.host.SomeMethod() to be marshaled to the host. | |
var last_host_call = 0; | |
window.host = { __noSuchMethod__: function(id, xs) | |
{ | |
/* host bridge for gecko-1.9.1 / geckofx-1.9.0 */ | |
/* set up the args object */ | |
$("callinfo").remove(); | |
var callinfo = $.tag("callinfo"); | |
callinfo.attr("funcname", id); | |
callinfo.attr("argc", xs.length); | |
for (var i = 0; i < xs.length; i++) | |
callinfo.attr("arg_" + i, xs[i]); | |
$("#main").append(callinfo); | |
/* make the call: we use the doc title to make host calls because | |
it's otherwise not used with our frame */ | |
document.title = "host_call_" + (last_host_call++); | |
/* fetch the result */ | |
return callinfo.attr("retval"); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment