nosafe param to Emscripten Module.getValue is optional

This commit is contained in:
Dan Vanderkam
2015-11-13 15:56:36 -05:00
parent efd40e67ff
commit f7ef9c6192
2 changed files with 4 additions and 2 deletions

View File

@@ -11,6 +11,8 @@ function ModuleTest(): void {
var myTypedArray = new Uint8Array(10);
var buf = Module._malloc(myTypedArray.length*myTypedArray.BYTES_PER_ELEMENT);
Module.setValue(buf, 10, 'i32');
var x = Module.getValue(buf, 'i32') + 123;
Module.HEAPU8.set(myTypedArray, buf);
Module.ccall('my_function', 'number', ['number'], [buf]);
Module._free(buf);

View File

@@ -22,8 +22,8 @@ declare module Module {
function ccall(ident: string, returnType: string, argTypes: string[], args: any[]): any;
function cwrap(ident: string, returnType: string, argTypes: string[]): any;
function setValue(ptr: number, value: any, type: string, noSafe: boolean): void;
function getValue(ptr: number, type: string, noSafe: boolean): any;
function setValue(ptr: number, value: any, type: string, noSafe?: boolean): void;
function getValue(ptr: number, type: string, noSafe?: boolean): number;
var ALLOC_NORMAL: number;
var ALLOC_STACK: number;