source: js/sdk/README.txt @ 1324

Last change on this file since 1324 was 1324, checked in by Maciej Komosinski, 3 months ago

Updated for current SDK sources and current Emscripten

File size: 1.8 KB
RevLine 
[865]1Framsticks SDK in JavaScript
2----------------------------
3
4Note: Emscripten does not like spaces in paths.
5In order to compile the Framsticks SDK properly, ensure you don't have spaces in directory names.
6
7To generate the newest JavaScript version of the Framsticks SDK, you need to have the latest version
8of Emscripten installed. To perform a compilation, you first need to activate the Emscripten SDK:
9
[1324]10On Windows (deprecated):
[865]11        emsdk.bat activate latest
12
13On Linux:
14        emsdk activate latest
15
16The emsdk script should be available in your Emscripten install directory.
17"latest" can be replaced by any name of the Emscripten version installed.
18After activating the Emscripten SDK, to compile Framsticks SDK you need to call:
19
[1324]20On Windows (deprecated):
[865]21        emmake.bat mingw32-make.exe -j8 --directory=../../cpp -f ../js/sdk/Makefile-SDK-Emscripten.mak
22
23On Linux:
24        $EMSCRIPTEN/emmake make --directory=../../cpp -f ../js/sdk/Makefile-SDK-Emscripten.mak
25
26After completing this, the JavaScript version of Framsticks SDK should be available as frams-sdk.js.
27
28
29
30Classes, methods and fields available in JavaScript Framsticks SDK are defined in js_interface/js_interface.idl.
31To access them from a JavaScript app, you need to include the JavaScript version of Framsticks SDK file in HTML:
32        <script src="sdk/frams-sdk.js"></script>
33
34and then you can access Framsticks classes in JavaScript files using the Module variable like that:
35        let gcm = new Module.DefaultGenoConvManager();
36        gcm.addDefaultConverters();
37        let dummyGeno = new Module.Geno().useConverters(gcm);
38        Module.destroy(dummyGeno);
39        let validators = new Module.Validators();
40        dummyGeno = new Module.Geno().useValidators(validators);
41        Module.destroy(dummyGeno);
42        let modelValidator = new Module.ModelGenoValidator();
43        validators.append(modelValidator);
Note: See TracBrowser for help on using the repository browser.