Evaluates passed in argument as TJS expression.
Example:
Module.evalTJS('Debug.message(\"Hello world from TJS!\")');
Gets Uint8Array object mapped inside memory buffer of the Layer or Bitmap object.
The data is mapped inside of the C++ environment using HEAP.U8
array.
Second argument should be true if the buffer is to be written to.
Example:
var buf = Module.getLayerBitmapUInt8Array(layer_object, true);
buf[0] = 0xff;
buf[1] = 0xff;
buf[2] = 0xff;
buf[3] = 0xff;
Gets Uint8Array object of a file in the TVP storage.
The data will be copied and is not mapped inside of the C++ environment.
Example:
var buf = Module.getStorageUInt8Array("file://./data.xp3>in_storage_data.bin");
Gets String of a file in the TVP storage.
The second argument is the mode string. The syntax of the mode string is the same as e.g. Array.load
.
Example:
var str = Module.getStorageString("file://./data.xp3>in_storage_data.txt", "");
console.log(str);
Evaluates the passed in string as JS.
Example:
KirikiriEmscriptenInterface.evalJS('console.log(\"Hello world from JS!\")');
Evaluates the passed in storage as JS.
Second argument is the mode string and is optional.
Example:
KirikiriEmscriptenInterface.evalStorageJS('file://./data.xp3>in_storage_data.js', '');
- boolean -> Integer
- bigint -> Integer
- number -> Real
- string -> String
- function -> wrapped Object
- object -> wrapped Object
- Integer -> BigInt
- Real -> number
- String -> string
- Octet -> mapped Uint8Array
- Object -> wrapped function or object (depending on the result of
lhs instanceof "Function"
) usingProxy
object
Due to JS not supporting destructors, passing an object from TJS to JS will cause a memory leak, so it is recommended to pass objects as little as possible.
JS to TJS objects will be reference counted properly as usual.
- (
apply
) CallObject
instanceofFunction
:x(arg1, arg2)
- (
construct
) ConstructObject
:new x(arg1, arg2)
- (
get
) Get property by string or number:x["hoge"]
orx[1]
- (
set
) Set property by string or number:x["hoge"] = 1
orx[1] = 1
- (
has
) Has property by string or number:"hoge" in x
or1 in x
- (
deleteProperty
) Delete property by string or number:delete x["hoge"];
ordelete x[1];
- (
ownKeys
) List properties:Reflect.ownKeys(x)
- (
FuncCall
,FuncCallByNum
) Callobject
orfunction
:x(arg1, arg2)
- (
CreateNew
) Constructobject
orfunction
:new x(arg1, arg2)
- (
PropGet
,PropGetByNum
) Get property by string or number:x["hoge"]
orx[1]
- (
PropSet
,PropSetByNum
) Set property by string or number:x["hoge"] = 1
orx[1] = 1
- (
DeleteMember
,DeleteMemberByNum
) Delete property by string or number:delete x["hoge"];
ordelete x[1];
- (
EnumMembers
) Enumerate properties (not exposed directly in TJS)
Object
and String
values can be thrown.
At the moment, throwing Integer
and Real
values cause undefined behavior.
When throwing TJS Object
values across the JS<->TJS barrier, they will be converted to string
value.
When throwing JS string
or object
values across the JS<->TJS barrier, they will be converted to TJS Object
value of class Exception
.