javascriptcore

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Rendered for darwin/amd64

Overview

Package javascriptcore provides a fluent Go API over the macOS JavaScriptCore framework.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CurrentArguments

func CurrentArguments() *foundation.NSArray[objc.ID]

CurrentArguments calls the underlying JSContextCurrentArguments.

func JSBigIntCreateWithDouble

func JSBigIntCreateWithDouble(ctx unsafe.Pointer, value float64, exception unsafe.Pointer) unsafe.Pointer

JSBigIntCreateWithDouble calls raw.JSBigIntCreateWithDouble (C function JSBigIntCreateWithDouble).

func JSBigIntCreateWithInt64

func JSBigIntCreateWithInt64(ctx unsafe.Pointer, integer int64, exception unsafe.Pointer) unsafe.Pointer

JSBigIntCreateWithInt64 calls raw.JSBigIntCreateWithInt64 (C function JSBigIntCreateWithInt64).

func JSBigIntCreateWithString

func JSBigIntCreateWithString(ctx unsafe.Pointer, string_ unsafe.Pointer, exception unsafe.Pointer) unsafe.Pointer

JSBigIntCreateWithString calls raw.JSBigIntCreateWithString (C function JSBigIntCreateWithString).

func JSBigIntCreateWithUInt64

func JSBigIntCreateWithUInt64(ctx unsafe.Pointer, integer uint64, exception unsafe.Pointer) unsafe.Pointer

JSBigIntCreateWithUInt64 calls raw.JSBigIntCreateWithUInt64 (C function JSBigIntCreateWithUInt64).

func JSCheckScriptSyntax

func JSCheckScriptSyntax(ctx unsafe.Pointer, script unsafe.Pointer, sourceURL unsafe.Pointer, startingLineNumber int, exception unsafe.Pointer) bool

JSCheckScriptSyntax calls raw.JSCheckScriptSyntax (C function JSCheckScriptSyntax).

func JSClassCreate

func JSClassCreate(definition *raw.JSClassDefinition) unsafe.Pointer

JSClassCreate calls raw.JSClassCreate (C function JSClassCreate).

func JSClassRelease

func JSClassRelease(jsClass unsafe.Pointer)

JSClassRelease calls raw.JSClassRelease (C function JSClassRelease).

func JSClassRetain

func JSClassRetain(jsClass unsafe.Pointer) unsafe.Pointer

JSClassRetain calls raw.JSClassRetain (C function JSClassRetain).

func JSContextGetGlobalContext

func JSContextGetGlobalContext(ctx unsafe.Pointer) unsafe.Pointer

JSContextGetGlobalContext calls raw.JSContextGetGlobalContext (C function JSContextGetGlobalContext).

func JSContextGetGlobalObject

func JSContextGetGlobalObject(ctx unsafe.Pointer) unsafe.Pointer

JSContextGetGlobalObject calls raw.JSContextGetGlobalObject (C function JSContextGetGlobalObject).

func JSContextGetGroup

func JSContextGetGroup(ctx unsafe.Pointer) unsafe.Pointer

JSContextGetGroup calls raw.JSContextGetGroup (C function JSContextGetGroup).

func JSContextGroupCreate

func JSContextGroupCreate() unsafe.Pointer

JSContextGroupCreate calls raw.JSContextGroupCreate (C function JSContextGroupCreate).

func JSContextGroupRelease

func JSContextGroupRelease(group unsafe.Pointer)

JSContextGroupRelease calls raw.JSContextGroupRelease (C function JSContextGroupRelease).

func JSContextGroupRetain

func JSContextGroupRetain(group unsafe.Pointer) unsafe.Pointer

JSContextGroupRetain calls raw.JSContextGroupRetain (C function JSContextGroupRetain).

func JSEvaluateScript

func JSEvaluateScript(ctx unsafe.Pointer, script unsafe.Pointer, thisObject unsafe.Pointer, sourceURL unsafe.Pointer, startingLineNumber int, exception unsafe.Pointer) unsafe.Pointer

JSEvaluateScript calls raw.JSEvaluateScript (C function JSEvaluateScript).

func JSGarbageCollect

func JSGarbageCollect(ctx unsafe.Pointer)

JSGarbageCollect calls raw.JSGarbageCollect (C function JSGarbageCollect).

func JSGlobalContextCopyName

func JSGlobalContextCopyName(ctx unsafe.Pointer) unsafe.Pointer

JSGlobalContextCopyName calls raw.JSGlobalContextCopyName (C function JSGlobalContextCopyName).

func JSGlobalContextCreate

func JSGlobalContextCreate(globalObjectClass unsafe.Pointer) unsafe.Pointer

JSGlobalContextCreate calls raw.JSGlobalContextCreate (C function JSGlobalContextCreate).

func JSGlobalContextCreateInGroup

func JSGlobalContextCreateInGroup(group unsafe.Pointer, globalObjectClass unsafe.Pointer) unsafe.Pointer

JSGlobalContextCreateInGroup calls raw.JSGlobalContextCreateInGroup (C function JSGlobalContextCreateInGroup).

func JSGlobalContextIsInspectable

func JSGlobalContextIsInspectable(ctx unsafe.Pointer) bool

JSGlobalContextIsInspectable calls raw.JSGlobalContextIsInspectable (C function JSGlobalContextIsInspectable).

func JSGlobalContextRelease

func JSGlobalContextRelease(ctx unsafe.Pointer)

JSGlobalContextRelease calls raw.JSGlobalContextRelease (C function JSGlobalContextRelease).

func JSGlobalContextRetain

func JSGlobalContextRetain(ctx unsafe.Pointer) unsafe.Pointer

JSGlobalContextRetain calls raw.JSGlobalContextRetain (C function JSGlobalContextRetain).

func JSGlobalContextSetInspectable

func JSGlobalContextSetInspectable(ctx unsafe.Pointer, inspectable bool)

JSGlobalContextSetInspectable calls raw.JSGlobalContextSetInspectable (C function JSGlobalContextSetInspectable).

func JSGlobalContextSetName

func JSGlobalContextSetName(ctx unsafe.Pointer, name unsafe.Pointer)

JSGlobalContextSetName calls raw.JSGlobalContextSetName (C function JSGlobalContextSetName).

func JSObjectCallAsConstructor

func JSObjectCallAsConstructor(ctx unsafe.Pointer, object unsafe.Pointer, argumentCount uint, arguments unsafe.Pointer, exception unsafe.Pointer) unsafe.Pointer

JSObjectCallAsConstructor calls raw.JSObjectCallAsConstructor (C function JSObjectCallAsConstructor).

func JSObjectCallAsFunction

func JSObjectCallAsFunction(ctx unsafe.Pointer, object unsafe.Pointer, thisObject unsafe.Pointer, argumentCount uint, arguments unsafe.Pointer, exception unsafe.Pointer) unsafe.Pointer

JSObjectCallAsFunction calls raw.JSObjectCallAsFunction (C function JSObjectCallAsFunction).

func JSObjectCopyPropertyNames

func JSObjectCopyPropertyNames(ctx unsafe.Pointer, object unsafe.Pointer) unsafe.Pointer

JSObjectCopyPropertyNames calls raw.JSObjectCopyPropertyNames (C function JSObjectCopyPropertyNames).

func JSObjectDeleteProperty

func JSObjectDeleteProperty(ctx unsafe.Pointer, object unsafe.Pointer, propertyName unsafe.Pointer, exception unsafe.Pointer) bool

JSObjectDeleteProperty calls raw.JSObjectDeleteProperty (C function JSObjectDeleteProperty).

func JSObjectDeletePropertyForKey

func JSObjectDeletePropertyForKey(ctx unsafe.Pointer, object unsafe.Pointer, propertyKey unsafe.Pointer, exception unsafe.Pointer) bool

JSObjectDeletePropertyForKey calls raw.JSObjectDeletePropertyForKey (C function JSObjectDeletePropertyForKey).

func JSObjectGetArrayBufferByteLength

func JSObjectGetArrayBufferByteLength(ctx unsafe.Pointer, object unsafe.Pointer, exception unsafe.Pointer) uint

JSObjectGetArrayBufferByteLength calls raw.JSObjectGetArrayBufferByteLength (C function JSObjectGetArrayBufferByteLength).

func JSObjectGetArrayBufferBytesPtr

func JSObjectGetArrayBufferBytesPtr(ctx unsafe.Pointer, object unsafe.Pointer, exception unsafe.Pointer) unsafe.Pointer

JSObjectGetArrayBufferBytesPtr calls raw.JSObjectGetArrayBufferBytesPtr (C function JSObjectGetArrayBufferBytesPtr).

func JSObjectGetPrivate

func JSObjectGetPrivate(object unsafe.Pointer) unsafe.Pointer

JSObjectGetPrivate calls raw.JSObjectGetPrivate (C function JSObjectGetPrivate).

func JSObjectGetProperty

func JSObjectGetProperty(ctx unsafe.Pointer, object unsafe.Pointer, propertyName unsafe.Pointer, exception unsafe.Pointer) unsafe.Pointer

JSObjectGetProperty calls raw.JSObjectGetProperty (C function JSObjectGetProperty).

func JSObjectGetPropertyAtIndex

func JSObjectGetPropertyAtIndex(ctx unsafe.Pointer, object unsafe.Pointer, propertyIndex uint, exception unsafe.Pointer) unsafe.Pointer

JSObjectGetPropertyAtIndex calls raw.JSObjectGetPropertyAtIndex (C function JSObjectGetPropertyAtIndex).

func JSObjectGetPropertyForKey

func JSObjectGetPropertyForKey(ctx unsafe.Pointer, object unsafe.Pointer, propertyKey unsafe.Pointer, exception unsafe.Pointer) unsafe.Pointer

JSObjectGetPropertyForKey calls raw.JSObjectGetPropertyForKey (C function JSObjectGetPropertyForKey).

func JSObjectGetPrototype

func JSObjectGetPrototype(ctx unsafe.Pointer, object unsafe.Pointer) unsafe.Pointer

JSObjectGetPrototype calls raw.JSObjectGetPrototype (C function JSObjectGetPrototype).

func JSObjectGetTypedArrayBuffer

func JSObjectGetTypedArrayBuffer(ctx unsafe.Pointer, object unsafe.Pointer, exception unsafe.Pointer) unsafe.Pointer

JSObjectGetTypedArrayBuffer calls raw.JSObjectGetTypedArrayBuffer (C function JSObjectGetTypedArrayBuffer).

func JSObjectGetTypedArrayByteLength

func JSObjectGetTypedArrayByteLength(ctx unsafe.Pointer, object unsafe.Pointer, exception unsafe.Pointer) uint

JSObjectGetTypedArrayByteLength calls raw.JSObjectGetTypedArrayByteLength (C function JSObjectGetTypedArrayByteLength).

func JSObjectGetTypedArrayByteOffset

func JSObjectGetTypedArrayByteOffset(ctx unsafe.Pointer, object unsafe.Pointer, exception unsafe.Pointer) uint

JSObjectGetTypedArrayByteOffset calls raw.JSObjectGetTypedArrayByteOffset (C function JSObjectGetTypedArrayByteOffset).

func JSObjectGetTypedArrayBytesPtr

func JSObjectGetTypedArrayBytesPtr(ctx unsafe.Pointer, object unsafe.Pointer, exception unsafe.Pointer) unsafe.Pointer

JSObjectGetTypedArrayBytesPtr calls raw.JSObjectGetTypedArrayBytesPtr (C function JSObjectGetTypedArrayBytesPtr).

func JSObjectGetTypedArrayLength

func JSObjectGetTypedArrayLength(ctx unsafe.Pointer, object unsafe.Pointer, exception unsafe.Pointer) uint

JSObjectGetTypedArrayLength calls raw.JSObjectGetTypedArrayLength (C function JSObjectGetTypedArrayLength).

func JSObjectHasProperty

func JSObjectHasProperty(ctx unsafe.Pointer, object unsafe.Pointer, propertyName unsafe.Pointer) bool

JSObjectHasProperty calls raw.JSObjectHasProperty (C function JSObjectHasProperty).

func JSObjectHasPropertyForKey

func JSObjectHasPropertyForKey(ctx unsafe.Pointer, object unsafe.Pointer, propertyKey unsafe.Pointer, exception unsafe.Pointer) bool

JSObjectHasPropertyForKey calls raw.JSObjectHasPropertyForKey (C function JSObjectHasPropertyForKey).

func JSObjectIsConstructor

func JSObjectIsConstructor(ctx unsafe.Pointer, object unsafe.Pointer) bool

JSObjectIsConstructor calls raw.JSObjectIsConstructor (C function JSObjectIsConstructor).

func JSObjectIsFunction

func JSObjectIsFunction(ctx unsafe.Pointer, object unsafe.Pointer) bool

JSObjectIsFunction calls raw.JSObjectIsFunction (C function JSObjectIsFunction).

func JSObjectMake

func JSObjectMake(ctx unsafe.Pointer, jsClass unsafe.Pointer, data unsafe.Pointer) unsafe.Pointer

JSObjectMake calls raw.JSObjectMake (C function JSObjectMake).

func JSObjectMakeArray

func JSObjectMakeArray(ctx unsafe.Pointer, argumentCount uint, arguments unsafe.Pointer, exception unsafe.Pointer) unsafe.Pointer

JSObjectMakeArray calls raw.JSObjectMakeArray (C function JSObjectMakeArray).

func JSObjectMakeArrayBufferWithBytesNoCopy

func JSObjectMakeArrayBufferWithBytesNoCopy(ctx unsafe.Pointer, bytes_ unsafe.Pointer, byteLength uint, bytesDeallocator unsafe.Pointer, deallocatorContext unsafe.Pointer, exception unsafe.Pointer) unsafe.Pointer

JSObjectMakeArrayBufferWithBytesNoCopy calls raw.JSObjectMakeArrayBufferWithBytesNoCopy (C function JSObjectMakeArrayBufferWithBytesNoCopy).

func JSObjectMakeConstructor

func JSObjectMakeConstructor(ctx unsafe.Pointer, jsClass unsafe.Pointer, callAsConstructor unsafe.Pointer) unsafe.Pointer

JSObjectMakeConstructor calls raw.JSObjectMakeConstructor (C function JSObjectMakeConstructor).

func JSObjectMakeDate

func JSObjectMakeDate(ctx unsafe.Pointer, argumentCount uint, arguments unsafe.Pointer, exception unsafe.Pointer) unsafe.Pointer

JSObjectMakeDate calls raw.JSObjectMakeDate (C function JSObjectMakeDate).

func JSObjectMakeDeferredPromise

func JSObjectMakeDeferredPromise(ctx unsafe.Pointer, resolve unsafe.Pointer, reject unsafe.Pointer, exception unsafe.Pointer) unsafe.Pointer

JSObjectMakeDeferredPromise calls raw.JSObjectMakeDeferredPromise (C function JSObjectMakeDeferredPromise).

func JSObjectMakeError

func JSObjectMakeError(ctx unsafe.Pointer, argumentCount uint, arguments unsafe.Pointer, exception unsafe.Pointer) unsafe.Pointer

JSObjectMakeError calls raw.JSObjectMakeError (C function JSObjectMakeError).

func JSObjectMakeFunction

func JSObjectMakeFunction(ctx unsafe.Pointer, name unsafe.Pointer, parameterCount uint, parameterNames unsafe.Pointer, body unsafe.Pointer, sourceURL unsafe.Pointer, startingLineNumber int, exception unsafe.Pointer) unsafe.Pointer

JSObjectMakeFunction calls raw.JSObjectMakeFunction (C function JSObjectMakeFunction).

func JSObjectMakeFunctionWithCallback

func JSObjectMakeFunctionWithCallback(ctx unsafe.Pointer, name unsafe.Pointer, callAsFunction unsafe.Pointer) unsafe.Pointer

JSObjectMakeFunctionWithCallback calls raw.JSObjectMakeFunctionWithCallback (C function JSObjectMakeFunctionWithCallback).

func JSObjectMakeRegExp

func JSObjectMakeRegExp(ctx unsafe.Pointer, argumentCount uint, arguments unsafe.Pointer, exception unsafe.Pointer) unsafe.Pointer

JSObjectMakeRegExp calls raw.JSObjectMakeRegExp (C function JSObjectMakeRegExp).

func JSObjectMakeTypedArray

func JSObjectMakeTypedArray(ctx unsafe.Pointer, arrayType JSTypedArrayType, length uint, exception unsafe.Pointer) unsafe.Pointer

JSObjectMakeTypedArray calls raw.JSObjectMakeTypedArray (C function JSObjectMakeTypedArray).

func JSObjectMakeTypedArrayWithArrayBuffer

func JSObjectMakeTypedArrayWithArrayBuffer(ctx unsafe.Pointer, arrayType JSTypedArrayType, buffer unsafe.Pointer, exception unsafe.Pointer) unsafe.Pointer

JSObjectMakeTypedArrayWithArrayBuffer calls raw.JSObjectMakeTypedArrayWithArrayBuffer (C function JSObjectMakeTypedArrayWithArrayBuffer).

func JSObjectMakeTypedArrayWithArrayBufferAndOffset

func JSObjectMakeTypedArrayWithArrayBufferAndOffset(ctx unsafe.Pointer, arrayType JSTypedArrayType, buffer unsafe.Pointer, byteOffset uint, length uint, exception unsafe.Pointer) unsafe.Pointer

JSObjectMakeTypedArrayWithArrayBufferAndOffset calls raw.JSObjectMakeTypedArrayWithArrayBufferAndOffset (C function JSObjectMakeTypedArrayWithArrayBufferAndOffset).

func JSObjectMakeTypedArrayWithBytesNoCopy

func JSObjectMakeTypedArrayWithBytesNoCopy(ctx unsafe.Pointer, arrayType JSTypedArrayType, bytes_ unsafe.Pointer, byteLength uint, bytesDeallocator unsafe.Pointer, deallocatorContext unsafe.Pointer, exception unsafe.Pointer) unsafe.Pointer

JSObjectMakeTypedArrayWithBytesNoCopy calls raw.JSObjectMakeTypedArrayWithBytesNoCopy (C function JSObjectMakeTypedArrayWithBytesNoCopy).

func JSObjectSetPrivate

func JSObjectSetPrivate(object unsafe.Pointer, data unsafe.Pointer) bool

JSObjectSetPrivate calls raw.JSObjectSetPrivate (C function JSObjectSetPrivate).

func JSObjectSetProperty

func JSObjectSetProperty(ctx unsafe.Pointer, object unsafe.Pointer, propertyName unsafe.Pointer, value unsafe.Pointer, attributes uint, exception unsafe.Pointer)

JSObjectSetProperty calls raw.JSObjectSetProperty (C function JSObjectSetProperty).

func JSObjectSetPropertyAtIndex

func JSObjectSetPropertyAtIndex(ctx unsafe.Pointer, object unsafe.Pointer, propertyIndex uint, value unsafe.Pointer, exception unsafe.Pointer)

JSObjectSetPropertyAtIndex calls raw.JSObjectSetPropertyAtIndex (C function JSObjectSetPropertyAtIndex).

func JSObjectSetPropertyForKey

func JSObjectSetPropertyForKey(ctx unsafe.Pointer, object unsafe.Pointer, propertyKey unsafe.Pointer, value unsafe.Pointer, attributes uint, exception unsafe.Pointer)

JSObjectSetPropertyForKey calls raw.JSObjectSetPropertyForKey (C function JSObjectSetPropertyForKey).

func JSObjectSetPrototype

func JSObjectSetPrototype(ctx unsafe.Pointer, object unsafe.Pointer, value unsafe.Pointer)

JSObjectSetPrototype calls raw.JSObjectSetPrototype (C function JSObjectSetPrototype).

func JSPropertyDescriptorConfigurableKey added in v0.8.0

func JSPropertyDescriptorConfigurableKey() objc.ID

@const JSPropertyDescriptorConfigurableKey returns the string constant JSPropertyDescriptorConfigurableKey as an objc.ID, for use as a dictionary key or selector argument.

func JSPropertyDescriptorEnumerableKey added in v0.8.0

func JSPropertyDescriptorEnumerableKey() objc.ID

@const JSPropertyDescriptorEnumerableKey returns the string constant JSPropertyDescriptorEnumerableKey as an objc.ID, for use as a dictionary key or selector argument.

func JSPropertyDescriptorGetKey added in v0.8.0

func JSPropertyDescriptorGetKey() objc.ID

@const JSPropertyDescriptorGetKey returns the string constant JSPropertyDescriptorGetKey as an objc.ID, for use as a dictionary key or selector argument.

func JSPropertyDescriptorSetKey added in v0.8.0

func JSPropertyDescriptorSetKey() objc.ID

@const JSPropertyDescriptorSetKey returns the string constant JSPropertyDescriptorSetKey as an objc.ID, for use as a dictionary key or selector argument.

func JSPropertyDescriptorValueKey added in v0.8.0

func JSPropertyDescriptorValueKey() objc.ID

@const JSPropertyDescriptorValueKey returns the string constant JSPropertyDescriptorValueKey as an objc.ID, for use as a dictionary key or selector argument.

func JSPropertyDescriptorWritableKey added in v0.8.0

func JSPropertyDescriptorWritableKey() objc.ID

@group Property Descriptor Constants @discussion These keys may assist in creating a property descriptor for use with the defineProperty method on JSValue. Property descriptors must fit one of three descriptions: Data Descriptor: - A descriptor containing one or both of the keys <code>value</code> and <code>writable</code>, and optionally containing one or both of the keys <code>enumerable</code> and <code>configurable</code>. A data descriptor may not contain either the <code>get</code> or <code>set</code> key. A data descriptor may be used to create or modify the attributes of a data property on an object (replacing any existing accessor property). Accessor Descriptor: - A descriptor containing one or both of the keys <code>get</code> and <code>set</code>, and optionally containing one or both of the keys <code>enumerable</code> and <code>configurable</code>. An accessor descriptor may not contain either the <code>value</code> or <code>writable</code> key. An accessor descriptor may be used to create or modify the attributes of an accessor property on an object (replacing any existing data property). Generic Descriptor: - A descriptor containing one or both of the keys <code>enumerable</code> and <code>configurable</code>. A generic descriptor may not contain any of the keys <code>value</code>, <code>writable</code>, <code>get</code>, or <code>set</code>. A generic descriptor may be used to modify the attributes of an existing data or accessor property, or to create a new data property. @const JSPropertyDescriptorWritableKey returns the string constant JSPropertyDescriptorWritableKey as an objc.ID, for use as a dictionary key or selector argument.

func JSPropertyNameAccumulatorAddName

func JSPropertyNameAccumulatorAddName(accumulator unsafe.Pointer, propertyName unsafe.Pointer)

JSPropertyNameAccumulatorAddName calls raw.JSPropertyNameAccumulatorAddName (C function JSPropertyNameAccumulatorAddName).

func JSPropertyNameArrayGetCount

func JSPropertyNameArrayGetCount(array unsafe.Pointer) uint

JSPropertyNameArrayGetCount calls raw.JSPropertyNameArrayGetCount (C function JSPropertyNameArrayGetCount).

func JSPropertyNameArrayGetNameAtIndex

func JSPropertyNameArrayGetNameAtIndex(array unsafe.Pointer, index uint) unsafe.Pointer

JSPropertyNameArrayGetNameAtIndex calls raw.JSPropertyNameArrayGetNameAtIndex (C function JSPropertyNameArrayGetNameAtIndex).

func JSPropertyNameArrayRelease

func JSPropertyNameArrayRelease(array unsafe.Pointer)

JSPropertyNameArrayRelease calls raw.JSPropertyNameArrayRelease (C function JSPropertyNameArrayRelease).

func JSPropertyNameArrayRetain

func JSPropertyNameArrayRetain(array unsafe.Pointer) unsafe.Pointer

JSPropertyNameArrayRetain calls raw.JSPropertyNameArrayRetain (C function JSPropertyNameArrayRetain).

func JSStringCopyCFString

func JSStringCopyCFString(alloc unsafe.Pointer, string_ unsafe.Pointer) unsafe.Pointer

JSStringCopyCFString calls raw.JSStringCopyCFString (C function JSStringCopyCFString).

func JSStringCreateWithCFString

func JSStringCreateWithCFString(string_ unsafe.Pointer) unsafe.Pointer

JSStringCreateWithCFString calls raw.JSStringCreateWithCFString (C function JSStringCreateWithCFString).

func JSStringCreateWithCharacters

func JSStringCreateWithCharacters(chars *uint16, numChars uint) unsafe.Pointer

JSStringCreateWithCharacters calls raw.JSStringCreateWithCharacters (C function JSStringCreateWithCharacters).

func JSStringCreateWithUTF8CString

func JSStringCreateWithUTF8CString(string_ string) unsafe.Pointer

JSStringCreateWithUTF8CString calls raw.JSStringCreateWithUTF8CString (C function JSStringCreateWithUTF8CString).

func JSStringGetCharactersPtr

func JSStringGetCharactersPtr(string_ unsafe.Pointer) *uint16

JSStringGetCharactersPtr calls raw.JSStringGetCharactersPtr (C function JSStringGetCharactersPtr).

func JSStringGetLength

func JSStringGetLength(string_ unsafe.Pointer) uint

JSStringGetLength calls raw.JSStringGetLength (C function JSStringGetLength).

func JSStringGetMaximumUTF8CStringSize

func JSStringGetMaximumUTF8CStringSize(string_ unsafe.Pointer) uint

JSStringGetMaximumUTF8CStringSize calls raw.JSStringGetMaximumUTF8CStringSize (C function JSStringGetMaximumUTF8CStringSize).

func JSStringGetUTF8CString

func JSStringGetUTF8CString(string_ unsafe.Pointer, buffer string, bufferSize uint) uint

JSStringGetUTF8CString calls raw.JSStringGetUTF8CString (C function JSStringGetUTF8CString).

func JSStringIsEqual

func JSStringIsEqual(a unsafe.Pointer, b unsafe.Pointer) bool

JSStringIsEqual calls raw.JSStringIsEqual (C function JSStringIsEqual).

func JSStringIsEqualToUTF8CString

func JSStringIsEqualToUTF8CString(a unsafe.Pointer, b string) bool

JSStringIsEqualToUTF8CString calls raw.JSStringIsEqualToUTF8CString (C function JSStringIsEqualToUTF8CString).

func JSStringRelease

func JSStringRelease(string_ unsafe.Pointer)

JSStringRelease calls raw.JSStringRelease (C function JSStringRelease).

func JSStringRetain

func JSStringRetain(string_ unsafe.Pointer) unsafe.Pointer

JSStringRetain calls raw.JSStringRetain (C function JSStringRetain).

func JSValueCreateJSONString

func JSValueCreateJSONString(ctx unsafe.Pointer, value unsafe.Pointer, indent uint, exception unsafe.Pointer) unsafe.Pointer

JSValueCreateJSONString calls raw.JSValueCreateJSONString (C function JSValueCreateJSONString).

func JSValueIsArray

func JSValueIsArray(ctx unsafe.Pointer, value unsafe.Pointer) bool

JSValueIsArray calls raw.JSValueIsArray (C function JSValueIsArray).

func JSValueIsBigInt

func JSValueIsBigInt(ctx unsafe.Pointer, value unsafe.Pointer) bool

JSValueIsBigInt calls raw.JSValueIsBigInt (C function JSValueIsBigInt).

func JSValueIsBoolean

func JSValueIsBoolean(ctx unsafe.Pointer, value unsafe.Pointer) bool

JSValueIsBoolean calls raw.JSValueIsBoolean (C function JSValueIsBoolean).

func JSValueIsDate

func JSValueIsDate(ctx unsafe.Pointer, value unsafe.Pointer) bool

JSValueIsDate calls raw.JSValueIsDate (C function JSValueIsDate).

func JSValueIsEqual

func JSValueIsEqual(ctx unsafe.Pointer, a unsafe.Pointer, b unsafe.Pointer, exception unsafe.Pointer) bool

JSValueIsEqual calls raw.JSValueIsEqual (C function JSValueIsEqual).

func JSValueIsInstanceOfConstructor

func JSValueIsInstanceOfConstructor(ctx unsafe.Pointer, value unsafe.Pointer, constructor unsafe.Pointer, exception unsafe.Pointer) bool

JSValueIsInstanceOfConstructor calls raw.JSValueIsInstanceOfConstructor (C function JSValueIsInstanceOfConstructor).

func JSValueIsNull

func JSValueIsNull(ctx unsafe.Pointer, value unsafe.Pointer) bool

JSValueIsNull calls raw.JSValueIsNull (C function JSValueIsNull).

func JSValueIsNumber

func JSValueIsNumber(ctx unsafe.Pointer, value unsafe.Pointer) bool

JSValueIsNumber calls raw.JSValueIsNumber (C function JSValueIsNumber).

func JSValueIsObject

func JSValueIsObject(ctx unsafe.Pointer, value unsafe.Pointer) bool

JSValueIsObject calls raw.JSValueIsObject (C function JSValueIsObject).

func JSValueIsObjectOfClass

func JSValueIsObjectOfClass(ctx unsafe.Pointer, value unsafe.Pointer, jsClass unsafe.Pointer) bool

JSValueIsObjectOfClass calls raw.JSValueIsObjectOfClass (C function JSValueIsObjectOfClass).

func JSValueIsStrictEqual

func JSValueIsStrictEqual(ctx unsafe.Pointer, a unsafe.Pointer, b unsafe.Pointer) bool

JSValueIsStrictEqual calls raw.JSValueIsStrictEqual (C function JSValueIsStrictEqual).

func JSValueIsString

func JSValueIsString(ctx unsafe.Pointer, value unsafe.Pointer) bool

JSValueIsString calls raw.JSValueIsString (C function JSValueIsString).

func JSValueIsSymbol

func JSValueIsSymbol(ctx unsafe.Pointer, value unsafe.Pointer) bool

JSValueIsSymbol calls raw.JSValueIsSymbol (C function JSValueIsSymbol).

func JSValueIsUndefined

func JSValueIsUndefined(ctx unsafe.Pointer, value unsafe.Pointer) bool

JSValueIsUndefined calls raw.JSValueIsUndefined (C function JSValueIsUndefined).

func JSValueMakeBoolean

func JSValueMakeBoolean(ctx unsafe.Pointer, boolean bool) unsafe.Pointer

JSValueMakeBoolean calls raw.JSValueMakeBoolean (C function JSValueMakeBoolean).

func JSValueMakeFromJSONString

func JSValueMakeFromJSONString(ctx unsafe.Pointer, string_ unsafe.Pointer) unsafe.Pointer

JSValueMakeFromJSONString calls raw.JSValueMakeFromJSONString (C function JSValueMakeFromJSONString).

func JSValueMakeNull

func JSValueMakeNull(ctx unsafe.Pointer) unsafe.Pointer

JSValueMakeNull calls raw.JSValueMakeNull (C function JSValueMakeNull).

func JSValueMakeNumber

func JSValueMakeNumber(ctx unsafe.Pointer, number float64) unsafe.Pointer

JSValueMakeNumber calls raw.JSValueMakeNumber (C function JSValueMakeNumber).

func JSValueMakeString

func JSValueMakeString(ctx unsafe.Pointer, string_ unsafe.Pointer) unsafe.Pointer

JSValueMakeString calls raw.JSValueMakeString (C function JSValueMakeString).

func JSValueMakeSymbol

func JSValueMakeSymbol(ctx unsafe.Pointer, description unsafe.Pointer) unsafe.Pointer

JSValueMakeSymbol calls raw.JSValueMakeSymbol (C function JSValueMakeSymbol).

func JSValueMakeUndefined

func JSValueMakeUndefined(ctx unsafe.Pointer) unsafe.Pointer

JSValueMakeUndefined calls raw.JSValueMakeUndefined (C function JSValueMakeUndefined).

func JSValueProtect

func JSValueProtect(ctx unsafe.Pointer, value unsafe.Pointer)

JSValueProtect calls raw.JSValueProtect (C function JSValueProtect).

func JSValueToBoolean

func JSValueToBoolean(ctx unsafe.Pointer, value unsafe.Pointer) bool

JSValueToBoolean calls raw.JSValueToBoolean (C function JSValueToBoolean).

func JSValueToInt32

func JSValueToInt32(ctx unsafe.Pointer, value unsafe.Pointer, exception unsafe.Pointer) int32

JSValueToInt32 calls raw.JSValueToInt32 (C function JSValueToInt32).

func JSValueToInt64

func JSValueToInt64(ctx unsafe.Pointer, value unsafe.Pointer, exception unsafe.Pointer) int64

JSValueToInt64 calls raw.JSValueToInt64 (C function JSValueToInt64).

func JSValueToNumber

func JSValueToNumber(ctx unsafe.Pointer, value unsafe.Pointer, exception unsafe.Pointer) float64

JSValueToNumber calls raw.JSValueToNumber (C function JSValueToNumber).

func JSValueToObject

func JSValueToObject(ctx unsafe.Pointer, value unsafe.Pointer, exception unsafe.Pointer) unsafe.Pointer

JSValueToObject calls raw.JSValueToObject (C function JSValueToObject).

func JSValueToStringCopy

func JSValueToStringCopy(ctx unsafe.Pointer, value unsafe.Pointer, exception unsafe.Pointer) unsafe.Pointer

JSValueToStringCopy calls raw.JSValueToStringCopy (C function JSValueToStringCopy).

func JSValueToUInt32

func JSValueToUInt32(ctx unsafe.Pointer, value unsafe.Pointer, exception unsafe.Pointer) uint32

JSValueToUInt32 calls raw.JSValueToUInt32 (C function JSValueToUInt32).

func JSValueToUInt64

func JSValueToUInt64(ctx unsafe.Pointer, value unsafe.Pointer, exception unsafe.Pointer) uint64

JSValueToUInt64 calls raw.JSValueToUInt64 (C function JSValueToUInt64).

func JSValueUnprotect

func JSValueUnprotect(ctx unsafe.Pointer, value unsafe.Pointer)

JSValueUnprotect calls raw.JSValueUnprotect (C function JSValueUnprotect).

Types

type Context

type Context struct {
	// contains filtered or unexported fields
}

A JavaScript execution environment.

Context wraps raw.JSContext with a fluent Go API.

func ContextFromID

func ContextFromID(id objc.ID) *Context

ContextFromID adopts an existing object pointer as a Context (nil for 0).

func ContextWithJSGlobalContextRef

func ContextWithJSGlobalContextRef(jsGlobalContextRef unsafe.Pointer) *Context

ContextWithJSGlobalContextRef calls the underlying JSContextContextWithJSGlobalContextRef.

func CurrentContext

func CurrentContext() *Context

CurrentContext calls the underlying JSContextCurrentContext.

func NewContext

func NewContext() *Context

NewContext creates a new Context.

func NewContextWithVirtualMachine

func NewContextWithVirtualMachine(virtualMachine *raw.JSVirtualMachine) *Context

Creates a new JavaScript context associated with a specific virtual machine.

NewContextWithVirtualMachine creates a new Context.

func (*Context) EvaluateScript

func (x *Context) EvaluateScript(script string) *Value

Executes the specified JavaScript code.

EvaluateScript calls the underlying EvaluateScript.

func (*Context) EvaluateScriptWithSourceURL

func (x *Context) EvaluateScriptWithSourceURL(script string, sourceURL string) *Value

Executes the specified JavaScript code, treating the specified URL as its source location.

EvaluateScriptWithSourceURL calls the underlying EvaluateScriptWithSourceURL.

func (*Context) Exception

func (x *Context) Exception() *Value

@property @discussion The <code>exception</code> property may be used to throw an exception to JavaScript. Before a callback is made from JavaScript to an Objective-C block or method, the prior value of the exception property will be preserved and the property will be set to nil. After the callback has completed the new value of the exception property will be read, and prior value restored. If the new value of exception is not nil, the callback will result in that value being thrown. This property may also be used to check for uncaught exceptions arising from API function calls (since the default behaviour of <code>exceptionHandler</code> is to assign an uncaught exception to this property).

Exception calls the underlying Exception.

func (*Context) ExceptionHandler

func (x *Context) ExceptionHandler() objc.Block

@property @discussion If a call to an API function results in an uncaught JavaScript exception, the <code>exceptionHandler</code> block will be invoked. The default implementation for the exception handler will store the exception to the exception property on context. As a consequence the default behaviour is for uncaught exceptions occurring within a callback from JavaScript to be rethrown upon return. Setting this value to nil will cause all exceptions occurring within a callback from JavaScript to be silently caught.

ExceptionHandler calls the underlying ExceptionHandler.

func (*Context) GlobalObject

func (x *Context) GlobalObject() *Value

@property @abstract Get the global object of the context. @discussion This method retrieves the global object of the JavaScript execution context. Instances of JSContext originating from WebKit will return a reference to the WindowProxy object. @result The global object.

GlobalObject calls the underlying GlobalObject.

func (*Context) ID

func (x *Context) ID() objc.ID

ID returns the underlying Objective-C object pointer (objc.ID), for passing to C APIs that take an object or CFTypeRef pointer.

func (*Context) IsInspectable

func (x *Context) IsInspectable() bool

@property @discussion Controls whether this @link JSContext @/link is inspectable in Web Inspector. The default value is NO.

IsInspectable calls the underlying IsInspectable.

func (*Context) JSGlobalContextRef

func (x *Context) JSGlobalContextRef() unsafe.Pointer

JSGlobalContextRef calls the underlying JSGlobalContextRef.

func (*Context) Name

func (x *Context) Name() string

@property @discussion Name of the JSContext. Exposed when inspecting the context.

Name calls the underlying Name.

func (*Context) ObjectForKeyedSubscript

func (x *Context) ObjectForKeyedSubscript(key objc.ID) *Value

Returns the value of the specified JavaScript property in the context’s global object, allowing subscript getter syntax.

ObjectForKeyedSubscript calls the underlying ObjectForKeyedSubscript.

func (*Context) SetException

func (x *Context) SetException(exception *raw.JSValue)

SetException calls the underlying SetException.

func (*Context) SetExceptionHandler

func (x *Context) SetExceptionHandler(exceptionHandler func(*raw.JSContext, *raw.JSValue))

SetExceptionHandler calls the underlying SetExceptionHandler.

func (*Context) SetInspectable

func (x *Context) SetInspectable(inspectable bool)

SetInspectable calls the underlying SetInspectable.

func (*Context) SetName

func (x *Context) SetName(name string)

SetName calls the underlying SetName.

func (*Context) SetObjectForKeyedSubscript

func (x *Context) SetObjectForKeyedSubscript(object objc.ID, key *foundation.NSObject)

Sets the specified JavaScript property of the context’s global object, allowing subscript setter syntax.

SetObjectForKeyedSubscript calls the underlying SetObjectForKeyedSubscript.

func (*Context) Unwrap

func (x *Context) Unwrap() *raw.JSContext

Unwrap returns the underlying raw.JSContext.

func (*Context) VirtualMachine

func (x *Context) VirtualMachine() *VirtualMachine

@property @discussion All instances of JSContext are associated with a JSVirtualMachine.

VirtualMachine calls the underlying VirtualMachine.

func (*Context) WithException

func (x *Context) WithException(exception *Value) *Context

A JavaScript exception to be thrown in evaluation of the script.

WithException sets the exception property and returns the receiver for chaining.

func (*Context) WithExceptionHandler

func (x *Context) WithExceptionHandler(exceptionHandler func(*raw.JSContext, *raw.JSValue)) *Context

A block to be invoked should evaluating a script result in a JavaScript exception being thrown.

WithExceptionHandler sets the exceptionHandler property and returns the receiver for chaining.

func (*Context) WithInspectable

func (x *Context) WithInspectable(inspectable bool) *Context

A Boolean value that indicates whether you can inspect the JavaScript context with Safari Web Inspector.

WithInspectable sets the inspectable property and returns the receiver for chaining.

func (*Context) WithName

func (x *Context) WithName(name string) *Context

A descriptive name for the context.

WithName sets the name property and returns the receiver for chaining.

type Contextable

type Contextable interface {
	Unwrap() *raw.JSContext
	WithException(exception *Value) *Context
	WithExceptionHandler(exceptionHandler func(*raw.JSContext, *raw.JSValue)) *Context
	WithName(name string) *Context
	WithInspectable(inspectable bool) *Context
	EvaluateScript(script string) *Value
	EvaluateScriptWithSourceURL(script string, sourceURL string) *Value
	GlobalObject() *Value
	Exception() *Value
	SetException(exception *raw.JSValue)
	ExceptionHandler() objc.Block
	SetExceptionHandler(exceptionHandler func(*raw.JSContext, *raw.JSValue))
	VirtualMachine() *VirtualMachine
	Name() string
	SetName(name string)
	IsInspectable() bool
	SetInspectable(inspectable bool)
	ObjectForKeyedSubscript(key objc.ID) *Value
	SetObjectForKeyedSubscript(object objc.ID, key *foundation.NSObject)
	JSGlobalContextRef() unsafe.Pointer
}

Contextable is the interface implemented by Context, for mocking and DI.

type JSClassDefinition added in v0.8.0

type JSClassDefinition = raw.JSClassDefinition

JSClassDefinition is a type alias for the raw JSClassDefinition value-type struct.

type JSRelationCondition added in v0.5.0

type JSRelationCondition int64
const (
	KJSRelationConditionUndefined   JSRelationCondition = 0
	KJSRelationConditionEqual       JSRelationCondition = 1
	KJSRelationConditionGreaterThan JSRelationCondition = 2
	KJSRelationConditionLessThan    JSRelationCondition = 3
)

func JSValueCompare

func JSValueCompare(ctx unsafe.Pointer, left unsafe.Pointer, right unsafe.Pointer, exception unsafe.Pointer) JSRelationCondition

JSValueCompare calls raw.JSValueCompare (C function JSValueCompare).

func JSValueCompareDouble

func JSValueCompareDouble(ctx unsafe.Pointer, left unsafe.Pointer, right float64, exception unsafe.Pointer) JSRelationCondition

JSValueCompareDouble calls raw.JSValueCompareDouble (C function JSValueCompareDouble).

func JSValueCompareInt64

func JSValueCompareInt64(ctx unsafe.Pointer, left unsafe.Pointer, right int64, exception unsafe.Pointer) JSRelationCondition

JSValueCompareInt64 calls raw.JSValueCompareInt64 (C function JSValueCompareInt64).

func JSValueCompareUInt64

func JSValueCompareUInt64(ctx unsafe.Pointer, left unsafe.Pointer, right uint64, exception unsafe.Pointer) JSRelationCondition

JSValueCompareUInt64 calls raw.JSValueCompareUInt64 (C function JSValueCompareUInt64).

func (JSRelationCondition) String added in v0.5.0

func (e JSRelationCondition) String() string

type JSStaticFunction added in v0.8.0

type JSStaticFunction = raw.JSStaticFunction

JSStaticFunction is a type alias for the raw JSStaticFunction value-type struct.

type JSStaticValue added in v0.8.0

type JSStaticValue = raw.JSStaticValue

JSStaticValue is a type alias for the raw JSStaticValue value-type struct.

type JSType added in v0.5.0

type JSType int64

Constants that identify the type of a JavaScript value.

const (
	KJSTypeUndefined JSType = 0
	KJSTypeNull      JSType = 1
	KJSTypeBoolean   JSType = 2
	KJSTypeNumber    JSType = 3
	KJSTypeString    JSType = 4
	KJSTypeObject    JSType = 5
	KJSTypeSymbol    JSType = 6
	KJSTypeBigInt    JSType = 7
)

func JSValueGetType

func JSValueGetType(ctx unsafe.Pointer, value unsafe.Pointer) JSType

JSValueGetType calls raw.JSValueGetType (C function JSValueGetType).

func (JSType) String added in v0.5.0

func (e JSType) String() string

type JSTypedArrayType added in v0.5.0

type JSTypedArrayType int64

The type of a JavaScript typed array object.

const (
	KJSTypedArrayTypeInt8Array         JSTypedArrayType = 0
	KJSTypedArrayTypeInt16Array        JSTypedArrayType = 1
	KJSTypedArrayTypeInt32Array        JSTypedArrayType = 2
	KJSTypedArrayTypeUint8Array        JSTypedArrayType = 3
	KJSTypedArrayTypeUint8ClampedArray JSTypedArrayType = 4
	KJSTypedArrayTypeUint16Array       JSTypedArrayType = 5
	KJSTypedArrayTypeUint32Array       JSTypedArrayType = 6
	KJSTypedArrayTypeFloat32Array      JSTypedArrayType = 7
	KJSTypedArrayTypeFloat64Array      JSTypedArrayType = 8
	KJSTypedArrayTypeArrayBuffer       JSTypedArrayType = 9
	KJSTypedArrayTypeNone              JSTypedArrayType = 10
	KJSTypedArrayTypeBigInt64Array     JSTypedArrayType = 11
	KJSTypedArrayTypeBigUint64Array    JSTypedArrayType = 12
)

func JSValueGetTypedArrayType

func JSValueGetTypedArrayType(ctx unsafe.Pointer, value unsafe.Pointer, exception unsafe.Pointer) JSTypedArrayType

JSValueGetTypedArrayType calls raw.JSValueGetTypedArrayType (C function JSValueGetTypedArrayType).

func (JSTypedArrayType) String added in v0.5.0

func (e JSTypedArrayType) String() string

type ManagedValue

type ManagedValue struct {
	// contains filtered or unexported fields
}

A JavaScript value with conditional retain behavior to provide automatic memory management.

ManagedValue wraps raw.JSManagedValue with a fluent Go API.

func ManagedValueFromID

func ManagedValueFromID(id objc.ID) *ManagedValue

ManagedValueFromID adopts an existing object pointer as a ManagedValue (nil for 0).

func ManagedValueWithValue

func ManagedValueWithValue(value *raw.JSValue) *ManagedValue

ManagedValueWithValue calls the underlying JSManagedValueManagedValueWithValue.

func ManagedValueWithValueAndOwner

func ManagedValueWithValueAndOwner(value *raw.JSValue, owner objc.ID) *ManagedValue

ManagedValueWithValueAndOwner calls the underlying JSManagedValueManagedValueWithValueAndOwner.

func NewManagedValueWithValue

func NewManagedValueWithValue(value *raw.JSValue) *ManagedValue

Initializes a managed value with the specified JavaScript value.

NewManagedValueWithValue creates a new ManagedValue.

func (*ManagedValue) ID

func (x *ManagedValue) ID() objc.ID

ID returns the underlying Objective-C object pointer (objc.ID), for passing to C APIs that take an object or CFTypeRef pointer.

func (*ManagedValue) Unwrap

func (x *ManagedValue) Unwrap() *raw.JSManagedValue

Unwrap returns the underlying raw.JSManagedValue.

func (*ManagedValue) Value

func (x *ManagedValue) Value() *Value

Value calls the underlying Value.

type ManagedValueable

type ManagedValueable interface {
	Unwrap() *raw.JSManagedValue
	Value() *Value
}

ManagedValueable is the interface implemented by ManagedValue, for mocking and DI.

type Value

type Value struct {
	// contains filtered or unexported fields
}

A JavaScript value.

Value wraps raw.JSValue with a fluent Go API.

func CurrentCallee

func CurrentCallee() *Value

CurrentCallee calls the underlying JSContextCurrentCallee.

func CurrentThis

func CurrentThis() *Value

CurrentThis calls the underlying JSContextCurrentThis.

func NewValue

func NewValue() *Value

NewValue creates a new Value.

func ValueFromID

func ValueFromID(id objc.ID) *Value

ValueFromID adopts an existing object pointer as a Value (nil for 0).

func ValueWithBoolInContext

func ValueWithBoolInContext(value bool, context_ *raw.JSContext) *Value

ValueWithBoolInContext calls the underlying JSValueValueWithBoolInContext.

func ValueWithDoubleInContext

func ValueWithDoubleInContext(value float64, context_ *raw.JSContext) *Value

ValueWithDoubleInContext calls the underlying JSValueValueWithDoubleInContext.

func ValueWithInt32InContext

func ValueWithInt32InContext(value int32, context_ *raw.JSContext) *Value

ValueWithInt32InContext calls the underlying JSValueValueWithInt32InContext.

func ValueWithJSValueRefInContext

func ValueWithJSValueRefInContext(value unsafe.Pointer, context_ *raw.JSContext) *Value

ValueWithJSValueRefInContext calls the underlying JSValueValueWithJSValueRefInContext.

func ValueWithNewArrayInContext

func ValueWithNewArrayInContext(context_ *raw.JSContext) *Value

ValueWithNewArrayInContext calls the underlying JSValueValueWithNewArrayInContext.

func ValueWithNewBigIntFromDoubleInContext

func ValueWithNewBigIntFromDoubleInContext(value float64, context_ *raw.JSContext) *Value

ValueWithNewBigIntFromDoubleInContext calls the underlying JSValueValueWithNewBigIntFromDoubleInContext.

func ValueWithNewBigIntFromInt64InContext

func ValueWithNewBigIntFromInt64InContext(int64 int64, context_ *raw.JSContext) *Value

ValueWithNewBigIntFromInt64InContext calls the underlying JSValueValueWithNewBigIntFromInt64InContext.

func ValueWithNewBigIntFromStringInContext

func ValueWithNewBigIntFromStringInContext(string_ string, context_ *raw.JSContext) *Value

ValueWithNewBigIntFromStringInContext calls the underlying JSValueValueWithNewBigIntFromStringInContext.

func ValueWithNewBigIntFromUInt64InContext

func ValueWithNewBigIntFromUInt64InContext(uint64 uint64, context_ *raw.JSContext) *Value

ValueWithNewBigIntFromUInt64InContext calls the underlying JSValueValueWithNewBigIntFromUInt64InContext.

func ValueWithNewErrorFromMessageInContext

func ValueWithNewErrorFromMessageInContext(message string, context_ *raw.JSContext) *Value

ValueWithNewErrorFromMessageInContext calls the underlying JSValueValueWithNewErrorFromMessageInContext.

func ValueWithNewObjectInContext

func ValueWithNewObjectInContext(context_ *raw.JSContext) *Value

ValueWithNewObjectInContext calls the underlying JSValueValueWithNewObjectInContext.

func ValueWithNewPromiseInContextFromExecutor

func ValueWithNewPromiseInContextFromExecutor(context_ *raw.JSContext, callback func(*raw.JSValue, *raw.JSValue)) *Value

ValueWithNewPromiseInContextFromExecutor calls the underlying JSValueValueWithNewPromiseInContextFromExecutor.

func ValueWithNewPromiseRejectedWithReasonInContext

func ValueWithNewPromiseRejectedWithReasonInContext(reason objc.ID, context_ *raw.JSContext) *Value

ValueWithNewPromiseRejectedWithReasonInContext calls the underlying JSValueValueWithNewPromiseRejectedWithReasonInContext.

func ValueWithNewPromiseResolvedWithResultInContext

func ValueWithNewPromiseResolvedWithResultInContext(result objc.ID, context_ *raw.JSContext) *Value

ValueWithNewPromiseResolvedWithResultInContext calls the underlying JSValueValueWithNewPromiseResolvedWithResultInContext.

func ValueWithNewRegularExpressionFromPatternFlagsInContext

func ValueWithNewRegularExpressionFromPatternFlagsInContext(pattern string, flags string, context_ *raw.JSContext) *Value

ValueWithNewRegularExpressionFromPatternFlagsInContext calls the underlying JSValueValueWithNewRegularExpressionFromPatternFlagsInContext.

func ValueWithNewSymbolFromDescriptionInContext

func ValueWithNewSymbolFromDescriptionInContext(description string, context_ *raw.JSContext) *Value

ValueWithNewSymbolFromDescriptionInContext calls the underlying JSValueValueWithNewSymbolFromDescriptionInContext.

func ValueWithNullInContext

func ValueWithNullInContext(context_ *raw.JSContext) *Value

ValueWithNullInContext calls the underlying JSValueValueWithNullInContext.

func ValueWithObjectInContext

func ValueWithObjectInContext(value objc.ID, context_ *raw.JSContext) *Value

ValueWithObjectInContext calls the underlying JSValueValueWithObjectInContext.

func ValueWithPointInContext

func ValueWithPointInContext(point corefoundation.CGPoint, context_ *raw.JSContext) *Value

ValueWithPointInContext calls the underlying JSValueValueWithPointInContext.

func ValueWithRangeInContext

func ValueWithRangeInContext(range_ foundation.NSRange, context_ *raw.JSContext) *Value

ValueWithRangeInContext calls the underlying JSValueValueWithRangeInContext.

func ValueWithRectInContext

func ValueWithRectInContext(rect corefoundation.CGRect, context_ *raw.JSContext) *Value

ValueWithRectInContext calls the underlying JSValueValueWithRectInContext.

func ValueWithSizeInContext

func ValueWithSizeInContext(size corefoundation.CGSize, context_ *raw.JSContext) *Value

ValueWithSizeInContext calls the underlying JSValueValueWithSizeInContext.

func ValueWithUInt32InContext

func ValueWithUInt32InContext(value uint32, context_ *raw.JSContext) *Value

ValueWithUInt32InContext calls the underlying JSValueValueWithUInt32InContext.

func ValueWithUndefinedInContext

func ValueWithUndefinedInContext(context_ *raw.JSContext) *Value

ValueWithUndefinedInContext calls the underlying JSValueValueWithUndefinedInContext.

func (*Value) CallWithArguments

func (x *Value) CallWithArguments(arguments *foundation.NSArray[objc.ID]) *Value

Invokes the value as a JavaScript function.

CallWithArguments calls the underlying CallWithArguments.

func (*Value) CompareDouble

func (x *Value) CompareDouble(other float64) JSRelationCondition

@method @abstract Compare a JSValue with a double. @other The double to compare with. @result A value of JSRelationCondition, a kJSRelationConditionUndefined is returned if an exception is thrown. @discussion The JSValue is converted to a double according to the rules specified by the JavaScript language then compared with <code>other</code>.

CompareDouble calls the underlying CompareDouble.

func (*Value) CompareInt64

func (x *Value) CompareInt64(other int64) JSRelationCondition

@method @abstract Compare a JSValue with a <code>int64_t</code>. @other The <code>int64_t</code> to compare with. @result A value of JSRelationCondition, a kJSRelationConditionUndefined is returned if an exception is thrown. @discussion The JSValue is converted to an integer according to the rules specified by the JavaScript language then compared with <code>other</code>.

CompareInt64 calls the underlying CompareInt64.

func (*Value) CompareJSValue

func (x *Value) CompareJSValue(other *raw.JSValue) JSRelationCondition

@method @abstract Compare two JSValues. @other The JSValue to compare with. @result A value of JSRelationCondition, a kJSRelationConditionUndefined is returned if an exception is thrown. @discussion The result is computed by comparing the results of JavaScript's <code>==</code>, <code><</code>, and <code>></code> operators. If either <code>self</code> or <code>other</code> is (or would coerce to) <code>NaN</code> in JavaScript, then the result is kJSRelationConditionUndefined.

CompareJSValue calls the underlying CompareJSValue.

func (*Value) CompareUInt64

func (x *Value) CompareUInt64(other uint64) JSRelationCondition

@method @abstract Compare a JSValue with a <code>uint64_t</code>. @other The <code>uint64_t</code> to compare with. @result A value of JSRelationCondition, a kJSRelationConditionUndefined is returned if an exception is thrown. @discussion The JSValue is converted to an integer according to the rules specified by the JavaScript language then compared with <code>other</code>.

CompareUInt64 calls the underlying CompareUInt64.

func (*Value) ConstructWithArguments

func (x *Value) ConstructWithArguments(arguments *foundation.NSArray[objc.ID]) *Value

Invokes the value as a JavaScript constructor.

ConstructWithArguments calls the underlying ConstructWithArguments.

func (*Value) Context

func (x *Value) Context() *Context

@property @abstract The JSContext that this value originates from.

Context calls the underlying Context.

func (*Value) DefinePropertyDescriptor

func (x *Value) DefinePropertyDescriptor(property objc.ID, descriptor objc.ID)

Defines a property on the JavaScript object value or modifies a property’s definition.

DefinePropertyDescriptor calls the underlying DefinePropertyDescriptor.

func (*Value) DeleteProperty

func (x *Value) DeleteProperty(property objc.ID) bool

Deletes the named property from the JavaScript object value.

DeleteProperty calls the underlying DeleteProperty.

func (*Value) HasProperty

func (x *Value) HasProperty(property objc.ID) bool

Returns a Boolean value indicating whether the JavaScript value has a defined property with the specified name.

HasProperty calls the underlying HasProperty.

func (*Value) ID

func (x *Value) ID() objc.ID

ID returns the underlying Objective-C object pointer (objc.ID), for passing to C APIs that take an object or CFTypeRef pointer.

func (*Value) InvokeMethodWithArguments

func (x *Value) InvokeMethodWithArguments(method string, arguments *foundation.NSArray[objc.ID]) *Value

Calls the named JavaScript method on the value.

InvokeMethodWithArguments calls the underlying InvokeMethodWithArguments.

func (*Value) IsArray

func (x *Value) IsArray() bool

@property @abstract Check if a JSValue is an array.

IsArray calls the underlying IsArray.

func (*Value) IsBigInt

func (x *Value) IsBigInt() bool

@property @abstract Check if a JSValue is a BigInt.

IsBigInt calls the underlying IsBigInt.

func (*Value) IsBoolean

func (x *Value) IsBoolean() bool

@property @abstract Check if a JSValue is a boolean.

IsBoolean calls the underlying IsBoolean.

func (*Value) IsDate

func (x *Value) IsDate() bool

@property @abstract Check if a JSValue is a date.

IsDate calls the underlying IsDate.

func (*Value) IsEqualToObject

func (x *Value) IsEqualToObject(value objc.ID) bool

Compares the value to another for strict equality.

IsEqualToObject calls the underlying IsEqualToObject.

func (*Value) IsEqualWithTypeCoercionToObject

func (x *Value) IsEqualWithTypeCoercionToObject(value objc.ID) bool

Compares the value to another for equivalence, allowing type conversion.

IsEqualWithTypeCoercionToObject calls the underlying IsEqualWithTypeCoercionToObject.

func (*Value) IsInstanceOf

func (x *Value) IsInstanceOf(value objc.ID) bool

Returns a Boolean value indicating whether the value is an instance of another JavaScript object value.

IsInstanceOf calls the underlying IsInstanceOf.

func (*Value) IsNull

func (x *Value) IsNull() bool

@property @abstract Check if a JSValue corresponds to the JavaScript value <code>null</code>.

IsNull calls the underlying IsNull.

func (*Value) IsNumber

func (x *Value) IsNumber() bool

@property @abstract Check if a JSValue is a number. @discussion In JavaScript, there is no differentiation between types of numbers. Semantically all numbers behave like doubles except in special cases like bit operations.

IsNumber calls the underlying IsNumber.

func (*Value) IsObject

func (x *Value) IsObject() bool

@property @abstract Check if a JSValue is an object.

IsObject calls the underlying IsObject.

func (*Value) IsString

func (x *Value) IsString() bool

@property @abstract Check if a JSValue is a string.

IsString calls the underlying IsString.

func (*Value) IsSymbol

func (x *Value) IsSymbol() bool

@property @abstract Check if a JSValue is a symbol.

IsSymbol calls the underlying IsSymbol.

func (*Value) IsUndefined

func (x *Value) IsUndefined() bool

@property @abstract Check if a JSValue corresponds to the JavaScript value <code>undefined</code>.

IsUndefined calls the underlying IsUndefined.

func (*Value) JSValueRef

func (x *Value) JSValueRef() unsafe.Pointer

JSValueRef calls the underlying JSValueRef.

func (*Value) ObjectAtIndexedSubscript

func (x *Value) ObjectAtIndexedSubscript(index uint) *Value

Returns the value’s JavaScript property at the specified index, allowing subscript syntax.

ObjectAtIndexedSubscript calls the underlying ObjectAtIndexedSubscript.

func (*Value) ObjectForKeyedSubscript

func (x *Value) ObjectForKeyedSubscript(key objc.ID) *Value

Returns the value’s JavaScript property named with the specified key, allowing subscript syntax.

ObjectForKeyedSubscript calls the underlying ObjectForKeyedSubscript.

func (*Value) SetObjectAtIndexedSubscript

func (x *Value) SetObjectAtIndexedSubscript(object objc.ID, index uint)

Sets the value’s JavaScript property at the specified index, allowing subscript syntax.

SetObjectAtIndexedSubscript calls the underlying SetObjectAtIndexedSubscript.

func (*Value) SetObjectForKeyedSubscript

func (x *Value) SetObjectForKeyedSubscript(object objc.ID, key objc.ID)

Sets the value’s JavaScript property named with the specified key, allowing subscript syntax.

SetObjectForKeyedSubscript calls the underlying SetObjectForKeyedSubscript.

func (*Value) SetValueAtIndex

func (x *Value) SetValueAtIndex(value objc.ID, index uint)

Sets the value at the specified numeric index in the JavaScript object value.

SetValueAtIndex calls the underlying SetValueAtIndex.

func (*Value) SetValueForProperty

func (x *Value) SetValueForProperty(value objc.ID, property objc.ID)

Sets the value of the named property in the JavaScript object value.

SetValueForProperty calls the underlying SetValueForProperty.

func (*Value) ToArray

func (x *Value) ToArray() *foundation.NSArray[objc.ID]

Converts the JavaScript value to an array.

ToArray calls the underlying ToArray.

func (*Value) ToBool

func (x *Value) ToBool() bool

Converts the JavaScript value to a native Boolean value.

ToBool calls the underlying ToBool.

func (*Value) ToDate

func (x *Value) ToDate() *foundation.NSDate

Converts the JavaScript value to a date object.

ToDate calls the underlying ToDate.

func (*Value) ToDictionary

func (x *Value) ToDictionary() *foundation.NSDictionary[objc.ID, objc.ID]

Converts the JavaScript value to a dictionary.

ToDictionary calls the underlying ToDictionary.

func (*Value) ToDouble

func (x *Value) ToDouble() float64

Converts the JavaScript value to a native floating-point value.

ToDouble calls the underlying ToDouble.

func (*Value) ToInt32

func (x *Value) ToInt32() int32

Converts the JavaScript value to a native signed integer value.

ToInt32 calls the underlying ToInt32.

func (*Value) ToInt64

func (x *Value) ToInt64() int64

@method @abstract Convert a JSValue to a <code>int64_t</code>. @discussion The JSValue is converted to an integer according to the rules specified by the JavaScript language. If the value is a BigInt, then the value is truncated to an <code>int64_t</code>.

ToInt64 calls the underlying ToInt64.

func (*Value) ToNumber

func (x *Value) ToNumber() *foundation.NSNumber

Converts the JavaScript value to a NSNumber object.

ToNumber calls the underlying ToNumber.

func (*Value) ToObject

func (x *Value) ToObject() objc.ID

Converts the JavaScript value to a native object.

ToObject calls the underlying ToObject.

func (*Value) ToObjectOfClass

func (x *Value) ToObjectOfClass(expectedClass objc.Class) objc.ID

Converts the JavaScript value to a native object of the specified class.

ToObjectOfClass calls the underlying ToObjectOfClass.

func (*Value) ToPoint

func (x *Value) ToPoint() corefoundation.CGPoint

Converts the value to a point structure.

ToPoint calls the underlying ToPoint.

func (*Value) ToRange

func (x *Value) ToRange() foundation.NSRange

Converts the value to a range.

ToRange calls the underlying ToRange.

func (*Value) ToRect

func (x *Value) ToRect() corefoundation.CGRect

Converts the value to a rectangle structure.

ToRect calls the underlying ToRect.

func (*Value) ToSize

func (x *Value) ToSize() corefoundation.CGSize

Converts the value to a size.

ToSize calls the underlying ToSize.

func (*Value) ToString

func (x *Value) ToString() string

Converts the JavaScript value to a native string.

ToString calls the underlying ToString.

func (*Value) ToUInt32

func (x *Value) ToUInt32() uint32

Converts the JavaScript value to a native unsigned integer value.

ToUInt32 calls the underlying ToUInt32.

func (*Value) ToUInt64

func (x *Value) ToUInt64() uint64

@method @abstract Convert a JSValue to a <code>uint64_t</code>. @discussion The JSValue is converted to an integer according to the rules specified by the JavaScript language. If the value is a BigInt, then the value is truncated to a <code>uint64_t</code>.

ToUInt64 calls the underlying ToUInt64.

func (*Value) Unwrap

func (x *Value) Unwrap() *raw.JSValue

Unwrap returns the underlying raw.JSValue.

func (*Value) ValueAtIndex

func (x *Value) ValueAtIndex(index uint) *Value

Returns the value at the specified numeric index in the JavaScript object value.

ValueAtIndex calls the underlying ValueAtIndex.

func (*Value) ValueForProperty

func (x *Value) ValueForProperty(property objc.ID) *Value

Returns the value of the named property in the JavaScript object value.

ValueForProperty calls the underlying ValueForProperty.

type Valueable

type Valueable interface {
	Unwrap() *raw.JSValue
	ToObject() objc.ID
	ToObjectOfClass(expectedClass objc.Class) objc.ID
	ToBool() bool
	ToDouble() float64
	ToInt32() int32
	ToUInt32() uint32
	ToInt64() int64
	ToUInt64() uint64
	ToNumber() *foundation.NSNumber
	ToString() string
	ToDate() *foundation.NSDate
	ToArray() *foundation.NSArray[objc.ID]
	ToDictionary() *foundation.NSDictionary[objc.ID, objc.ID]
	IsInstanceOf(value objc.ID) bool
	IsEqualToObject(value objc.ID) bool
	IsEqualWithTypeCoercionToObject(value objc.ID) bool
	CompareJSValue(other *raw.JSValue) JSRelationCondition
	CompareInt64(other int64) JSRelationCondition
	CompareUInt64(other uint64) JSRelationCondition
	CompareDouble(other float64) JSRelationCondition
	CallWithArguments(arguments *foundation.NSArray[objc.ID]) *Value
	ConstructWithArguments(arguments *foundation.NSArray[objc.ID]) *Value
	InvokeMethodWithArguments(method string, arguments *foundation.NSArray[objc.ID]) *Value
	Context() *Context
	IsUndefined() bool
	IsNull() bool
	IsBoolean() bool
	IsNumber() bool
	IsString() bool
	IsObject() bool
	IsArray() bool
	IsDate() bool
	IsSymbol() bool
	IsBigInt() bool
	ToPoint() corefoundation.CGPoint
	ToRange() foundation.NSRange
	ToRect() corefoundation.CGRect
	ToSize() corefoundation.CGSize
	ValueForProperty(property objc.ID) *Value
	SetValueForProperty(value objc.ID, property objc.ID)
	DeleteProperty(property objc.ID) bool
	HasProperty(property objc.ID) bool
	DefinePropertyDescriptor(property objc.ID, descriptor objc.ID)
	ValueAtIndex(index uint) *Value
	SetValueAtIndex(value objc.ID, index uint)
	ObjectForKeyedSubscript(key objc.ID) *Value
	ObjectAtIndexedSubscript(index uint) *Value
	SetObjectForKeyedSubscript(object objc.ID, key objc.ID)
	SetObjectAtIndexedSubscript(object objc.ID, index uint)
	JSValueRef() unsafe.Pointer
}

Valueable is the interface implemented by Value, for mocking and DI.

type VirtualMachine

type VirtualMachine struct {
	// contains filtered or unexported fields
}

A self-contained environment for JavaScript execution.

VirtualMachine wraps raw.JSVirtualMachine with a fluent Go API.

func NewVirtualMachine

func NewVirtualMachine() *VirtualMachine

NewVirtualMachine creates a new VirtualMachine.

func VirtualMachineFromID

func VirtualMachineFromID(id objc.ID) *VirtualMachine

VirtualMachineFromID adopts an existing object pointer as a VirtualMachine (nil for 0).

func (*VirtualMachine) AddManagedReferenceWithOwner

func (x *VirtualMachine) AddManagedReferenceWithOwner(object objc.ID, owner objc.ID)

Notifies the JavaScriptCore virtual machine of an external object relationship.

AddManagedReferenceWithOwner calls the underlying AddManagedReferenceWithOwner.

func (*VirtualMachine) ID

func (x *VirtualMachine) ID() objc.ID

ID returns the underlying Objective-C object pointer (objc.ID), for passing to C APIs that take an object or CFTypeRef pointer.

func (*VirtualMachine) RemoveManagedReferenceWithOwner

func (x *VirtualMachine) RemoveManagedReferenceWithOwner(object objc.ID, owner objc.ID)

Notifies the JavaScriptCore virtual machine that a previously registered object relationship no longer exists.

RemoveManagedReferenceWithOwner calls the underlying RemoveManagedReferenceWithOwner.

func (*VirtualMachine) Unwrap

func (x *VirtualMachine) Unwrap() *raw.JSVirtualMachine

Unwrap returns the underlying raw.JSVirtualMachine.

type VirtualMachineable

type VirtualMachineable interface {
	Unwrap() *raw.JSVirtualMachine
	AddManagedReferenceWithOwner(object objc.ID, owner objc.ID)
	RemoveManagedReferenceWithOwner(object objc.ID, owner objc.ID)
}

VirtualMachineable is the interface implemented by VirtualMachine, for mocking and DI.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL