My Project
jsni.h
Go to the documentation of this file.
1 // JavaScript Native Interface Release License.
2 //
3 // Copyright (c) 2015-2017 Alibaba Group. All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are met:
7 // * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer.
9 // * Redistributions in binary form must reproduce the above copyright
10 // notice, this list of conditions and the following disclaimer in the
11 // documentation and/or other materials provided with the distribution.
12 // * Neither the name of the Alibaba Group nor the
13 // names of its contributors may be used to endorse or promote products
14 // derived from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 // DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
20 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 
27 
35 #ifndef INCLUDE_JSNI_H_
36 #define INCLUDE_JSNI_H_
37 
38 // For size_t.
39 #include <stddef.h>
40 // For bool.
41 #include <stdbool.h>
42 // For uint16_t.
43 #include <stdint.h>
44 
48 typedef struct _JSValueRef* JSValueRef;
49 
53 typedef struct _JSNIEnv JSNIEnv;
54 
58 typedef void (*JSNIGCCallback)(JSNIEnv*, void*);
59 
63 typedef struct _JSNICallbackInfo* JSNICallbackInfo;
64 
68 typedef void (*JSNICallback)(JSNIEnv*, const JSNICallbackInfo);
69 
73 typedef struct _JSGlobalValueRef* JSGlobalValueRef;
74 
78 typedef enum {
102 
104 typedef enum {
106  JSNINone = 0,
108  JSNIReadOnly = 1 << 0,
110  JSNIDontEnum = 1 << 1,
112  JSNIDontDelete = 1 << 2
114 
116 typedef struct {
122 
124 typedef struct {
132  void* data;
134 
136 typedef struct {
142 
144 typedef enum {
149 } JSNIErrorCode;
150 
152 typedef struct {
154  const char* msg;
157 } JSNIErrorInfo;
158 
159 
160 #if defined(__cplusplus)
161 extern "C" {
162 #endif
163 
173 int JSNIGetVersion(JSNIEnv* env);
174 
183 bool JSNIRegisterMethod(JSNIEnv* env, const JSValueRef recv, const char* name, JSNICallback callback);
184 
192 
201 
210 
218 
227 
234 bool JSNIIsUndefined(JSNIEnv* env, JSValueRef val);
235 
242 
249 bool JSNIIsNull(JSNIEnv* env, JSValueRef val);
250 
257 
264 bool JSNIIsBoolean(JSNIEnv* env, JSValueRef val);
265 
272 bool JSNIToCBool(JSNIEnv* env, JSValueRef val);
273 
280 JSValueRef JSNINewBoolean(JSNIEnv* env, bool val);
281 
288 bool JSNIIsNumber(JSNIEnv* env, JSValueRef val);
289 
296 JSValueRef JSNINewNumber(JSNIEnv* env, double val);
297 
304 double JSNIToCDouble(JSNIEnv* env, JSValueRef val);
305 
313 int32_t JSNIToInt32(JSNIEnv* env, JSValueRef val);
314 
322 uint32_t JSNIToUint32(JSNIEnv* env, JSValueRef val);
323 
331 int64_t JSNIToInt64(JSNIEnv* env, JSValueRef val);
332 
339 bool JSNIIsSymbol(JSNIEnv* env, JSValueRef val);
340 
348 
355 bool JSNIIsString(JSNIEnv* env, JSValueRef val);
356 
366 JSValueRef JSNINewStringFromUtf8(JSNIEnv* env, const char* src, size_t length);
367 
374 size_t JSNIGetStringUtf8Length(JSNIEnv* env, JSValueRef string);
375 
386 size_t JSNIGetStringUtf8Chars(JSNIEnv* env, JSValueRef string, char* copy, size_t length);
387 
397 JSValueRef JSNINewString(JSNIEnv* env, const uint16_t* src, size_t length);
398 
406 size_t JSNIGetStringLength(JSNIEnv* env, JSValueRef string);
407 
418 size_t JSNIGetString(JSNIEnv* env, JSValueRef string, uint16_t* copy, size_t length);
419 
426 bool JSNIIsObject(JSNIEnv* env, JSValueRef val);
427 
434 bool JSNIIsEmpty(JSNIEnv* env, JSValueRef val);
435 
442 
450 bool JSNIHasProperty(JSNIEnv* env, JSValueRef object, const char* name);
451 
459 JSValueRef JSNIGetProperty(JSNIEnv* env, JSValueRef object, const char* name);
460 
469 bool JSNISetProperty(JSNIEnv* env, JSValueRef object, const char* name, JSValueRef property);
470 
480 bool JSNIDefineProperty(JSNIEnv* env, JSValueRef object, const char* name, const JSNIPropertyDescriptor descriptor);
481 
489 bool JSNIDeleteProperty(JSNIEnv* env, JSValueRef object, const char* name);
490 
498 
508 
515 int JSNIInternalFieldCount(JSNIEnv* env, JSValueRef object);
516 
525 void JSNISetInternalField(JSNIEnv* env, JSValueRef object, int index, void* field);
526 
534 void* JSNIGetInternalField(JSNIEnv* env, JSValueRef object, int index);
535 
542 bool JSNIIsFunction(JSNIEnv* env, JSValueRef val);
543 
551 
561 JSValueRef JSNICallFunction(JSNIEnv* env, JSValueRef func, JSValueRef recv, int argc, JSValueRef* argv);
562 
569 bool JSNIIsArray(JSNIEnv* env, JSValueRef val);
570 
577 size_t JSNIGetArrayLength(JSNIEnv* env, JSValueRef array);
578 
585 JSValueRef JSNINewArray(JSNIEnv* env, size_t initial_length);
586 
594 JSValueRef JSNIGetArrayElement(JSNIEnv* env, JSValueRef array, size_t index);
595 
604 void JSNISetArrayElement(JSNIEnv* env, JSValueRef array, size_t index, JSValueRef value);
605 
612 bool JSNIIsTypedArray(JSNIEnv* env, JSValueRef val);
613 
622 JSValueRef JSNINewTypedArray(JSNIEnv* env, JsTypedArrayType type, void* data, size_t length);
623 
631 
638 void* JSNIGetTypedArrayData(JSNIEnv* env, JSValueRef typed_array);
639 
646 size_t JSNIGetTypedArrayLength(JSNIEnv* env, JSValueRef typed_array);
647 
656 void JSNIPushLocalScope(JSNIEnv* env);
657 
664 void JSNIPopLocalScope(JSNIEnv* env);
665 
675 
685 
698 
706 
717 
728 
736 
747 void JSNISetGCCallback(JSNIEnv* env, JSGlobalValueRef val, void* args, JSNIGCCallback callback);
748 
756 void JSNIThrowErrorException(JSNIEnv* env, const char* errmsg);
757 
765 void JSNIThrowTypeErrorException(JSNIEnv* env, const char* errmsg);
766 
774 void JSNIThrowRangeErrorException(JSNIEnv* env, const char* errmsg);
775 
784 
792 bool JSNIHasException(JSNIEnv* env);
793 
800 void JSNIClearException(JSNIEnv* env);
801 
809 JSValueRef JSNINewError(JSNIEnv* env, const char* errmsg);
810 
818 JSValueRef JSNINewTypeError(JSNIEnv* env, const char* errmsg);
819 
827 JSValueRef JSNINewRangeError(JSNIEnv* env, const char* errmsg);
828 
836 void JSNIThrowErrorObject(JSNIEnv* env, JSValueRef error);
837 
845 bool JSNIIsError(JSNIEnv* env, JSValueRef val);
846 
856 JSValueRef JSNINewInstance(JSNIEnv* env, JSValueRef constructor, int argc, JSValueRef* argv);
857 
866 bool JSNIInstanceOf(JSNIEnv* env, JSValueRef left, JSValueRef right);
867 
876 
885 bool JSNIStrictEquals(JSNIEnv* env, JSValueRef left, JSValueRef right);
886 
894 JSValueRef JSNINewArrayBuffer(JSNIEnv* env, size_t length);
895 
904 JSValueRef JSNINewArrayBufferExternalized(JSNIEnv* env, void* data, size_t length);
905 
913 bool JSNIIsArrayBuffer(JSNIEnv* env, JSValueRef val);
914 
922 void* JSNIGetArrayBufferData(JSNIEnv* env, JSValueRef val);
923 
932 
941 
942 #if defined(__cplusplus)
943 }
944 #endif
945 
949 struct _JSNIEnv {
951  void* reserved;
952 };
953 
954 // JSNI Versions.
959 #define JSNI_VERSION_1_0 0x00010000
960 
965 #define JSNI_VERSION_1_1 0x00010001
966 
967 
974 #define JSNI_VERSION_2_0 0x00020000
975 
979 #define JSNI_VERSION_2_1 0x00020001
980 
984 #define JSNI_VERSION_2_2 0x00020002
985 
989 #define JSNI_VERSION_2_3 0x00020003
990 
991 #if defined(__cplusplus)
992 extern "C" {
993 #endif
994 
997 int JSNIInit(JSNIEnv* env, JSValueRef exports);
998 
999 #if defined(__cplusplus)
1000 }
1001 #endif
1002 
1003 #endif // INCLUDE_JSNI_H_
1004 
JSValueRef JSNINewTypeError(JSNIEnv *env, const char *errmsg)
Constructs a JavaScript TypeError object.
Definition: jsni.cc:1251
void(* JSNICallback)(JSNIEnv *, const JSNICallbackInfo)
Callback helper type.
Definition: jsni.h:68
int JSNIInternalFieldCount(JSNIEnv *env, JSValueRef object)
Gets the number of the internal field fo a JavaScript object.
Definition: jsni.cc:812
JSNICallback getter
Definition: jsni.h:126
JSValueRef JSNINewSymbol(JSNIEnv *env, JSValueRef val)
Constructs a new Symbol JavaScript value.
Definition: jsni.cc:608
bool JSNIStrictEquals(JSNIEnv *env, JSValueRef left, JSValueRef right)
Tests whether the left JavaScript value is strict-equal to the right JavaScript value.
Definition: jsni.cc:1326
bool JSNIIsEmpty(JSNIEnv *env, JSValueRef val)
Tests whether a JavaScript value is empty.
Definition: jsni.cc:704
Definition: jsni.h:112
size_t JSNIGetStringUtf8Length(JSNIEnv *env, JSValueRef string)
Returns the length in bytes of the UTF-8 representation of a string.
Definition: jsni.cc:633
Definition: jsni.h:136
bool JSNIIsTypedArray(JSNIEnv *env, JSValueRef val)
Tests whether a JavaScript value is TypedArray.
Definition: jsni.cc:949
JSValueRef JSNINewArrayBuffer(JSNIEnv *env, size_t length)
Constructs a JavaScript ArrayBuffer.
Definition: jsni.cc:1333
JSNIAccessorPropertyDescriptor * accessor_attributes
Definition: jsni.h:140
Definition: jsni.h:96
JSNI environment structure.
Definition: jsni.h:949
bool JSNIHasException(JSNIEnv *env)
Tests whether a JavaScript exception is being thrown. It&#39;s different with error get from JSNIGetLastE...
Definition: jsni.cc:1225
JsTypedArrayType JSNIGetTypedArrayType(JSNIEnv *env, JSValueRef typed_array)
Returns the type of the JavaScript TypedArray value.
Definition: jsni.cc:970
struct _JSNICallbackInfo * JSNICallbackInfo
Callback helper type.
Definition: jsni.h:63
JSValueRef JSNINewNumber(JSNIEnv *env, double val)
Constructs a new Number JavaScript value.
Definition: jsni.cc:546
bool JSNIIsObject(JSNIEnv *env, JSValueRef val)
Tests whether a JavaScript value is a JavaScript object.
Definition: jsni.cc:699
bool JSNIIsSymbol(JSNIEnv *env, JSValueRef val)
Tests whether the JavaScript value is Symbol.
Definition: jsni.cc:603
void * JSNIGetInternalField(JSNIEnv *env, JSValueRef object, int index)
Gets an internal field of a JavaScript object.
Definition: jsni.cc:827
JSNIErrorCode
Definition: jsni.h:144
bool JSNIHasProperty(JSNIEnv *env, JSValueRef object, const char *name)
Tests whether a JavaScript object has a property named name.
Definition: jsni.cc:727
JSValueRef JSNIGetProperty(JSNIEnv *env, JSValueRef object, const char *name)
Returns the property of the JavaScript object.
Definition: jsni.cc:742
void * data
Definition: jsni.h:132
int JSNIInit(JSNIEnv *env, JSValueRef exports)
This function is called by JSNI, not part of JSNI.
Definition: jsni.h:100
double JSNIToCDouble(JSNIEnv *env, JSValueRef val)
Converts the JavaScript value to C double.
Definition: jsni.cc:552
Definition: jsni.h:80
Definition: jsni.h:92
size_t JSNIAcquireGlobalValue(JSNIEnv *env, JSGlobalValueRef val)
Acquire the val means to increase the reference count of the val. Once the reference count of the val...
Definition: jsni.cc:1079
void JSNISetGCCallback(JSNIEnv *env, JSGlobalValueRef val, void *args, JSNIGCCallback callback)
Sets a callback which will be called when the JavaScript value pointed by val is freed. The developer can pass an argument to callback by args. JSNISetGCCallback() is only valid when reference count is bigger than zero.
Definition: jsni.cc:1096
const char * msg
Definition: jsni.h:154
JSValueRef JSNINewRangeError(JSNIEnv *env, const char *errmsg)
Constructs a JavaScript RangeError object.
Definition: jsni.cc:1263
JSValueRef JSNINewError(JSNIEnv *env, const char *errmsg)
Constructs a JavaScript Error object.
Definition: jsni.cc:1239
JSValueRef JSNINewStringFromUtf8(JSNIEnv *env, const char *src, size_t length)
Constructs a new String value from an array of characters in UTF-8 encoding.
Definition: jsni.cc:624
bool JSNIIsError(JSNIEnv *env, JSValueRef val)
Tests whether a JavaScript value is Error object.
Definition: jsni.cc:1282
Definition: jsni.h:98
bool JSNIIsBoolean(JSNIEnv *env, JSValueRef val)
Tests whether the JavaScript value is Boolean.
Definition: jsni.cc:518
void JSNISetArrayElement(JSNIEnv *env, JSValueRef array, size_t index, JSValueRef value)
Sets an element of a JavaScript array.
Definition: jsni.cc:924
JSValueRef value
Definition: jsni.h:118
JSValueRef JSNIGetNewTarget(JSNIEnv *env, JSNICallbackInfo info)
Gets the new.target value of the call.
Definition: jsni.cc:1316
void JSNISetReturnValue(JSNIEnv *env, JSNICallbackInfo info, JSValueRef val)
Sets the JavaScript return value for the callback.
Definition: jsni.cc:463
bool JSNIIsNumber(JSNIEnv *env, JSValueRef val)
Tests whether the JavaScript value is Number.
Definition: jsni.cc:541
struct _JSGlobalValueRef * JSGlobalValueRef
Global reference type.
Definition: jsni.h:73
void JSNIPushEscapableLocalScope(JSNIEnv *env)
Creates a local reference scope, and then all local references will be allocated within this referenc...
Definition: jsni.cc:1034
Definition: jsni.h:82
bool JSNIInstanceOf(JSNIEnv *env, JSValueRef left, JSValueRef right)
Tests whether left object is an instance of right object.
Definition: jsni.cc:1306
void JSNIDeleteGlobalValue(JSNIEnv *env, JSGlobalValueRef val)
Deletes the global reference pointed by val.
Definition: jsni.cc:1074
JSNIPropertyAttributes attributes
Definition: jsni.h:120
size_t JSNIGetTypedArrayLength(JSNIEnv *env, JSValueRef typed_array)
Returns the number of elements in the TypedArray value.
Definition: jsni.cc:995
bool JSNIIsString(JSNIEnv *env, JSValueRef val)
Tests whether the JavaScript value is String.
Definition: jsni.cc:619
JSValueRef JSNIGetPrototype(JSNIEnv *env, JSValueRef object)
Returns a prototype of a JavaScript object.
Definition: jsni.cc:803
bool JSNIDefineProperty(JSNIEnv *env, JSValueRef object, const char *name, const JSNIPropertyDescriptor descriptor)
Defines a new property directly on an object, or modifies an existing property on an object...
Definition: jsni.cc:1154
uint32_t JSNIToUint32(JSNIEnv *env, JSValueRef val)
Converts the JavaScript value to uint32.
Definition: jsni.cc:577
void JSNIThrowTypeErrorException(JSNIEnv *env, const char *errmsg)
Constructs an type error object with the message specified by errmsg and causes that type error to be...
Definition: jsni.cc:1116
Definition: jsni.h:152
struct _JSValueRef * JSValueRef
Reference type.
Definition: jsni.h:48
JSNIErrorInfo JSNIGetLastErrorInfo(JSNIEnv *env)
Tests whether there is error occured during pervious JSNI call. After calling JSNIGetLastErrorInfo()...
Definition: jsni.cc:1138
Definition: jsni.h:88
bool JSNIIsFunction(JSNIEnv *env, JSValueRef val)
Tests whether a JavaScript value is Function.
Definition: jsni.cc:837
int32_t JSNIToInt32(JSNIEnv *env, JSValueRef val)
Converts the JavaScript value to int32.
Definition: jsni.cc:564
void JSNIPushLocalScope(JSNIEnv *env)
Creates a local reference scope, and then all local references will be allocated within this referenc...
Definition: jsni.cc:1007
JSValueRef JSNINewObject(JSNIEnv *env)
Constructs a JavaScript object.
Definition: jsni.cc:709
bool JSNIToCBool(JSNIEnv *env, JSValueRef val)
Converts the JavaScript value to C bool.
Definition: jsni.cc:523
Definition: jsni.h:90
bool JSNIDeleteProperty(JSNIEnv *env, JSValueRef object, const char *name)
Deletes the property of a JavaScript object.
Definition: jsni.cc:784
bool JSNIIsArray(JSNIEnv *env, JSValueRef val)
Tests whether a JavaScript value is Array.
Definition: jsni.cc:881
JSValueRef JSNINewTypedArray(JSNIEnv *env, JsTypedArrayType type, void *data, size_t length)
Constructs a JavaScript TypedArray object.
Definition: jsni.cc:954
JSNIDataPropertyDescriptor * data_attributes
Definition: jsni.h:138
Definition: jsni.h:124
JSValueRef JSNIGetArgOfCallback(JSNIEnv *env, JSNICallbackInfo info, int id)
Returns the argument for the callback.
Definition: jsni.cc:411
JSValueRef JSNINewString(JSNIEnv *env, const uint16_t *src, size_t length)
Constructs a new String value from an array of characters in two bytes.
Definition: jsni.cc:661
JSValueRef JSNINewObjectWithInternalField(JSNIEnv *env, int count)
Constructs a JavaScript object with internal field. Internal field is a raw C pointer which can not b...
Definition: jsni.cc:716
void JSNIThrowErrorObject(JSNIEnv *env, JSValueRef error)
Throw JavaScript Error object.
Definition: jsni.cc:1275
JSNIPropertyAttributes
Definition: jsni.h:104
bool JSNISetProperty(JSNIEnv *env, JSValueRef object, const char *name, JSValueRef property)
Sets a property of a JavaScript object.
Definition: jsni.cc:761
JSValueRef JSNINewFunction(JSNIEnv *env, JSNICallback callback)
Constructs a JavaScript function with callback.
Definition: jsni.cc:842
JSValueRef JSNINewArrayBufferExternalized(JSNIEnv *env, void *data, size_t length)
Constructs a JavaScirpt ArrayBuffer with the externalized data.
Definition: jsni.cc:1340
Definition: jsni.h:146
Definition: jsni.h:108
JSValueRef JSNIGetArrayElement(JSNIEnv *env, JSValueRef array, size_t index)
Returns an element of a JavaScript array.
Definition: jsni.cc:905
bool JSNIIsUndefined(JSNIEnv *env, JSValueRef val)
Tests whether the JavaScript value is undefined.
Definition: jsni.cc:498
Definition: jsni.h:84
void * reserved
Definition: jsni.h:951
void JSNIThrowRangeErrorException(JSNIEnv *env, const char *errmsg)
Constructs an range error object with the message specified by errmsg and causes that type error to b...
Definition: jsni.cc:1127
JSNIPropertyAttributes attributes
Definition: jsni.h:130
Definition: jsni.h:106
JSValueRef JSNIPopEscapableLocalScope(JSNIEnv *env, JSValueRef val)
Pops off the current local reference scope, frees all the local references in the local reference sco...
Definition: jsni.cc:1042
JSValueRef JSNIGetPropertyNames(JSNIEnv *env, JSValueRef val)
Gets the names of the properties of the object.
Definition: jsni.cc:1367
JSNICallback setter
Definition: jsni.h:128
JSValueRef JSNINewInstance(JSNIEnv *env, JSValueRef constructor, int argc, JSValueRef *argv)
New an instance from a constructor.
Definition: jsni.cc:1290
Definition: jsni.h:116
Definition: jsni.h:148
size_t JSNIGetStringUtf8Chars(JSNIEnv *env, JSValueRef string, char *copy, size_t length)
Copyies a JavaScript string into a UTF-8 encoding string buffer.
Definition: jsni.cc:642
JsTypedArrayType
The type of a typed JavaScript array.
Definition: jsni.h:78
void JSNISetInternalField(JSNIEnv *env, JSValueRef object, int index, void *field)
Sets an internal field of a JavaScript object.
Definition: jsni.cc:817
int JSNIGetArgsLengthOfCallback(JSNIEnv *env, JSNICallbackInfo info)
Returns the number of arguments for the callback.
Definition: jsni.cc:388
int64_t JSNIToInt64(JSNIEnv *env, JSValueRef val)
Converts the JavaScript value to int64.
Definition: jsni.cc:590
Definition: jsni.h:94
void JSNIPopLocalScope(JSNIEnv *env)
Pops off the current local reference scope, frees all the local references in the local reference sco...
Definition: jsni.cc:1015
bool JSNIRegisterMethod(JSNIEnv *env, const JSValueRef recv, const char *name, JSNICallback callback)
Registers a native callback function.
Definition: jsni.cc:363
void(* JSNIGCCallback)(JSNIEnv *, void *)
GCCallback helper type.
Definition: jsni.h:58
size_t JSNIGetArrayLength(JSNIEnv *env, JSValueRef array)
Returns the number of elements in the array.
Definition: jsni.cc:886
int JSNIGetVersion(JSNIEnv *env)
Returns the version of the JSNI.
Definition: jsni.cc:358
JSValueRef JSNIGetGlobalValue(JSNIEnv *env, JSGlobalValueRef val)
Returns a local JSValueRef value from a JSGlobalValueRef value.
Definition: jsni.cc:1090
Definition: jsni.h:110
JSValueRef JSNINewBoolean(JSNIEnv *env, bool val)
Constructs a new Boolean JavaScript value.
Definition: jsni.cc:535
size_t JSNIReleaseGlobalValue(JSNIEnv *env, JSGlobalValueRef val)
Release the val means to decrease the reference count of the val. Once the reference count of the val...
Definition: jsni.cc:1085
void JSNIThrowErrorException(JSNIEnv *env, const char *errmsg)
Constructs an error object with the message specified by errmsg and causes that error to be thrown...
Definition: jsni.cc:1105
void JSNIClearException(JSNIEnv *env)
Clear a JavaScript exception that is being thrown. If there is no exception, this routine has no effe...
Definition: jsni.cc:1230
void * JSNIGetArrayBufferData(JSNIEnv *env, JSValueRef val)
Gets the pointer to the buffer of ArrayBuffer data.
Definition: jsni.cc:1353
bool JSNIIsArrayBuffer(JSNIEnv *env, JSValueRef val)
Tests whether a JavaScript value is ArrayBuffer.
Definition: jsni.cc:1347
JSValueRef JSNINewNull(JSNIEnv *env)
Constructs a new Null JavaScript value.
Definition: jsni.cc:513
bool JSNIIsNull(JSNIEnv *env, JSValueRef val)
Tests whether the JavaScript value is Null.
Definition: jsni.cc:508
JSValueRef JSNIGetThisOfCallback(JSNIEnv *env, JSNICallbackInfo info)
Returns "this" JavaScript object of the JavaScript function which current callback associated with...
Definition: jsni.cc:438
JSValueRef JSNINewUndefined(JSNIEnv *env)
Constructs a new Undefined JavaScript value.
Definition: jsni.cc:503
void * JSNIGetDataOfCallback(JSNIEnv *env, JSNICallbackInfo info)
Get the raw data which is passed to this callback.
Definition: jsni.cc:1201
JSValueRef JSNINewArray(JSNIEnv *env, size_t initial_length)
Constructs a JavaScript array with initial length: initial_length.
Definition: jsni.cc:898
JSNIErrorCode error_code
Definition: jsni.h:156
JSGlobalValueRef JSNINewGlobalValue(JSNIEnv *env, JSValueRef val)
Creates a new global reference to the JavaScript value referred to by the val argument. The global value must be explicitly disposed of by calling JSNIDeleteGlobalValue() or JSNIReleaseGlobalValue(). The global value will be alive untile calling JSNIDeleteGlobalValue() or JSNIReleaseGlobalValue() to dispose it. JSNIDeleteGlobalValue() dispose it immediately, whereas JSNIReleaseGlobalValue() dispose it when decrease the reference count to zero.
Definition: jsni.cc:1068
void * JSNIGetTypedArrayData(JSNIEnv *env, JSValueRef typed_array)
Returns the pointer to the buffer of TypedArray data.
Definition: jsni.cc:982
size_t JSNIGetArrayBufferLength(JSNIEnv *env, JSValueRef val)
Gets the length of ArrayBuffer.
Definition: jsni.cc:1360
JSValueRef JSNICallFunction(JSNIEnv *env, JSValueRef func, JSValueRef recv, int argc, JSValueRef *argv)
Calls a JavaScript function.
Definition: jsni.cc:859