diff options
Diffstat (limited to 'README')
-rw-r--r-- | README | 34 |
1 files changed, 34 insertions, 0 deletions
@@ -0,0 +1,34 @@ +Envjs implementation for QtScript. + +Envjs (http://www.envjs.com) is a simulated browser environment written in JavaScript. + +The code in this repository only implements the Envjs parts that need platform support. +You'll also need a file called env.js (not included in this repository), which is the +main Envjs implementation. To create it: +1. Go to http://www.envjs.com/release/envjs-1.2 and download the full release. +2. Unpack. +3. Run ant from the base Envjs directory. +4. Presto, dist/env.js is ready for evaluation. + +To use Envjs with QtScript, you'll need to +1. Evaluate env.js. +2. Call the function initializeEnvjsNatives() (in src/shared/envjsnatives.cpp). + +To achieve that, there are two major options: + +1. Fully embed Envjs in the application: Pass the contents of env.js to +QScriptEngine::evaluate(), and then call initializeEnvjsNatives(). You'll need +to add src/shared/envjsnatives.cpp to your application sources. + +2. Build the envjsnatives plugin (src/plugin) and put it in e.g. $QTDIR/plugins/script. +Then QScriptEngine::importExtension("envjs") can be used to load the native implementation. +env.js still needs to be evaluated separately before the plugin is loaded, otherwise +the plugin will throw an error. + +API-specific notes: +- In order for asynchronous XMLHttpRequest requests to work, you need to be running an +event loop. + +Tested with Envjs version 1.2. + +See also examples/README. |