jsc library

Classes

Bytes
A pointer to the byte buffer to be used as the backing store of the Typed Array object.
JSClass
A JavaScript class. Used with JSObjectMake to construct objects with custom behavior.
JSClassDefinition
struct JSStaticFunction This structure contains properties and callbacks that define a type of object. All fields other than the version field are optional. Any pointer may be NULL. The staticValues and staticFunctions arrays are the simplest and most efficient means for vending custom properties. Statically declared properties autmatically service requests like getProperty, setProperty, and getPropertyNames. Property access callbacks are required only to implement unusual properties, like array indexes, whose names are not known at compile-time.
JSContext
A JavaScript execution context. Holds the global object and other execution state.
JSContextGroup
JSContextGroupRef A group that associates JavaScript contexts with one another. Contexts in the same group may share and exchange JavaScript objects.
JSException
JSGlobalContext
JSObject
A JavaScript object. A JSObject is a
JSPropertyNameAccumulator
An ordered set used to collect the names of a JavaScript object's properties.
JSPropertyNameArray
An array of JavaScript property names.
JSReject
JSResolve
JSStaticFunction
JSStaticVale
JSString
A UTF16 character buffer. The fundamental string representation in JavaScript.
JSValue
A JavaScript value. The base type for all JavaScript values, and polymorphic functions on them.

Enums

JSClassAttributes
enum JSClassAttributes A set of JSClassAttributes. Combine multiple attributes by logically ORing them together.
JSPropertyAttributes
enum JSPropertyAttributes A set of JSPropertyAttributes. Combine multiple attributes by logically ORing them together.
JSType
enum JSType A constant identifying the type of a JSValue.
JSTypedArrayType
enum JSTypedArrayType A constant identifying the Typed Array type of a JSObjectRef. // iOS 10.0

Functions

callAsConstructorCallbackDartToNativeConverter(JSObjectCallAsConstructorCallback? callAsConstructor) NativeCallable<JSObjectCallAsConstructorCallback_>
callAsFunctionCallbackDartToNativeConverter(JSObjectCallAsFunctionCallback? callAsFunction) NativeCallable<JSObjectCallAsFunctionCallback_>
convertToTypeCallbackDartToNativeConverter(JSObjectConvertToTypeCallback? convertToType) NativeCallable<JSObjectConvertToTypeCallback_>
deletePropertyCallbackDartToNativeConverter(JSObjectDeletePropertyCallback? deleteProperty) NativeCallable<JSObjectDeletePropertyCallback_>
finalizeCallbackDartToNativeConverter(JSObjectFinalizeCallback? finalize) NativeCallable<JSObjectFinalizeCallback_>
getJSFRuntime({bool? enableLogger, Logger? logger}) → JSFRuntime
getPropertyCallbackDartToNativeConverter(JSObjectGetPropertyCallback? getProperty) NativeCallable<JSObjectGetPropertyCallback_>
getPropertyNamesCallbackDartToNativeConverter(JSObjectGetPropertyNamesCallback? getPropertyNames) NativeCallable<JSObjectGetPropertyNamesCallback_>
hasInstanceCallbackDartToNativeConverter(JSObjectHasInstanceCallback? hasInstance) NativeCallable<JSObjectHasInstanceCallback_>
hasPropertyCallbackDartToNativeConverter(JSObjectHasPropertyCallback? hasProperty) NativeCallable<JSObjectHasPropertyCallback_>
initializeCallbackDartToNativeConverter(JSObjectInitializeCallback? initialize) NativeCallable<JSObjectInitializeCallback_>
setPropertyCallbackDartToNativeConverter(JSObjectSetPropertyCallback? setProperty) NativeCallable<JSObjectSetPropertyCallback_>
typedArrayBytesDeallocatorCallbackDartToNativeConverter(JSTypedArrayBytesDeallocator? convertToType, int len) NativeCallable<JSTypedArrayBytesDeallocator_>

Typedefs

JSObjectCallAsConstructorCallback = JSObject Function(JSContext ctx, JSObject constructor, int argumentCount, List<JSValue> arguments, JSException exception)
typedef JSObjectCallAsConstructorCallback The callback invoked when an object is used as a constructor in a 'new' expression. ctx The execution context to use. constructor A JSObject that is the constructor being called. argumentCount An integer count of the number of arguments in arguments. arguments A JSValue array of the arguments passed to the function. exception A pointer to a JSValueRef in which to return an exception, if any. @result A JSObject that is the constructor's return value. If you named your function CallAsConstructor, you would declare it like this:
JSObjectCallAsFunctionCallback = JSValue Function(JSContext ctx, JSObject function, JSObject thisObject, int argumentCount, List<JSValue> arguments, JSException exception)
typedef JSObjectCallAsFunctionCallback The callback invoked when an object is called as a function. ctx The execution context to use. function A JSObject that is the function being called. thisObject A JSObject that is the 'this' variable in the function's scope. argumentCount An integer count of the number of arguments in arguments. arguments A JSValue array of the arguments passed to the function. exception A pointer to a JSValueRef in which to return an exception, if any. @result A JSValue that is the function's return value. If you named your function CallAsFunction, you would declare it like this:
JSObjectConvertToTypeCallback = JSValue Function(JSContext ctx, JSObject obj, int type, JSException exception)
typedef JSObjectConvertToTypeCallback The callback invoked when converting an object to a particular JavaScript type. ctx The execution context to use. object The JSObject to convert. type A JSType specifying the JavaScript type to convert to. exception A pointer to a JSValueRef in which to return an exception, if any. @result The objects's converted value, or NULL if the object was not converted. If you named your function ConvertToType, you would declare it like this:
JSObjectDeletePropertyCallback = bool Function(JSContext ctx, JSObject object, JSString propertyName, JSException exception)
typedef JSObjectDeletePropertyCallback The callback invoked when deleting a property. ctx The execution context to use. object The JSObject in which to delete the property. propertyName A JSString containing the name of the property to delete. exception A pointer to a JSValueRef in which to return an exception, if any. @result true if propertyName was successfully deleted, otherwise false. If you named your function DeleteProperty, you would declare it like this:
JSObjectFinalizeCallback = void Function(JSObjectRef object)
typedef JSObjectFinalizeCallback The callback invoked when an object is finalized (prepared for garbage collection). An object may be finalized on any thread. object The JSObject being finalized. If you named your function Finalize, you would declare it like this:
JSObjectGetPropertyCallback = JSValue Function(JSContext ctx, JSObject object, JSString propertyName, JSException exception)
typedef JSObjectGetPropertyCallback The callback invoked when getting a property's value. ctx The execution context to use. object The JSObject to search for the property. propertyName A JSString containing the name of the property to get. exception A pointer to a JSValueRef in which to return an exception, if any. @result The property's value if object has the property, otherwise NULL. If you named your function GetProperty, you would declare it like this:
JSObjectGetPropertyNamesCallback = void Function(JSContext ctx, JSObject object, JSPropertyNameAccumulator propertyNames)
typedef JSObjectGetPropertyNamesCallback The callback invoked when collecting the names of an object's properties. ctx The execution context to use. object The JSObject whose property names are being collected. propertyNames A JavaScript property name accumulator in which to accumulate the names of object's properties. If you named your function GetPropertyNames, you would declare it like this:
JSObjectHasInstanceCallback = bool Function(JSContext ctx, JSObject constructor, JSValue possibleInstance, JSException)
typedef JSObjectHasInstanceCallback hasInstance The callback invoked when an object is used as the target of an 'instanceof' expression. ctx The execution context to use. constructor The JSObject that is the target of the 'instanceof' expression. possibleInstance The JSValue being tested to determine if it is an instance of constructor. exception A pointer to a JSValueRef in which to return an exception, if any. @result true if possibleInstance is an instance of constructor, otherwise false. If you named your function HasInstance, you would declare it like this:
JSObjectHasPropertyCallback = bool Function(JSContext ctx, JSObject object, JSString propertyName)
typedef JSObjectHasPropertyCallback The callback invoked when determining whether an object has a property. ctx The execution context to use. object The JSObject to search for the property. propertyName A JSString containing the name of the property look up. @result true if object has the property, otherwise false. If you named your function HasProperty, you would declare it like this:
JSObjectInitializeCallback = void Function(JSContext ctx, JSObject object)
typedef JSObjectInitializeCallback The callback invoked when an object is first created. ctx The execution context to use. object The JSObject being created. If you named your function Initialize, you would declare it like this:
JSObjectSetPropertyCallback = bool Function(JSContext ctx, JSObject object, JSString propertyName, JSValue value, JSException exception)
typedef JSObjectSetPropertyCallback The callback invoked when setting a property's value. ctx The execution context to use. object The JSObject on which to set the property's value. propertyName A JSString containing the name of the property to set. value A JSValue to use as the property's value. exception A pointer to a JSValueRef in which to return an exception, if any. @result true if the property was set, otherwise false. If you named your function SetProperty, you would declare it like this:

Exceptions / Errors

JSError