Files
OpenRA/OpenRA.Launcher.Gtk/bridge.js
Matthew Bowra-Dean a561dd376e Proof of concept browser + embedded web server communicating via XMLHttpRequest.
Compile with "gcc -Wall `pkg-config --cflags --libs gtk+-2.0 webkit-1.0 libmicrohttpd` -o launcher main.c server.c"
Requires GTK, libwebkit and libmicrohttpd.
2011-01-02 16:11:55 +13:00

27 lines
645 B
JavaScript

window.external=new Object();
window.external.do_ajax=function(uri)
{
request = new XMLHttpRequest();
request.open("GET", uri, false);
try
{
request.send(null);
}
catch(err)
{
}
return request.responseText;
};
window.external.log=function(msg)
{
window.external.do_ajax("http://localhost:48764/log?msg=" + escape(msg));
};
window.external.launchMod=function(mod)
{
window.external.do_ajax("http://localhost:48764/launch?mod=" + mod);
};
window.external.existsInMod=function(file, mod)
{
return window.external.do_ajax("http://localhost:48764/fileExists?mod=" + mod + "&file=" + escape(file));
};