Problem is that the "companion" part also needs XMLHttpRequest and GPS thing which is not supported by QScriptEngine
My idea would be doing the app handlers as a separate deamon and communicate with the main daemon. (dbus?)