Package apple.javascriptcore
Class JSContext
- java.lang.Object
-
- org.moe.natj.general.NativeObject
-
- org.moe.natj.objc.ObjCObject
-
- apple.NSObject
-
- apple.javascriptcore.JSContext
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceJSContext.Block_exceptionHandler_retstatic interfaceJSContext.Block_setExceptionHandler-
Nested classes/interfaces inherited from class apple.NSObject
NSObject.Function_instanceMethodForSelector_ret, NSObject.Function_methodForSelector_ret
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedJSContext(org.moe.natj.general.Pointer peer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleanaccessInstanceVariablesDirectly()static JSContextalloc()static java.lang.ObjectallocWithZone(org.moe.natj.general.ptr.VoidPtr zone)static booleanautomaticallyNotifiesObserversForKey(java.lang.String key)static voidcancelPreviousPerformRequestsWithTarget(java.lang.Object aTarget)static voidcancelPreviousPerformRequestsWithTargetSelectorObject(java.lang.Object aTarget, org.moe.natj.objc.SEL aSelector, java.lang.Object anArgument)static NSArray<java.lang.String>classFallbacksForKeyedArchiver()static org.moe.natj.objc.ClassclassForKeyedUnarchiver()static JSContextcontextWithJSGlobalContextRef(JSGlobalContextRef jsGlobalContextRef)Create a JSContext, wrapping its C API counterpart.static NSArray<?>currentArguments()Get the arguments to the current callback.static JSValuecurrentCallee()Get the JavaScript function that is currently executing.static JSContextcurrentContext()[@methodgroup] Callback Accessors Get the JSContext that is currently executing.static JSValuecurrentThis()Get thethisvalue of the currently executing method.static java.lang.StringdebugDescription_static()static java.lang.Stringdescription_static()JSValueevaluateScript(java.lang.String script)[@methodgroup] Evaluating Scripts Evaluate a string of JavaScript code.JSValueevaluateScriptWithSourceURL(java.lang.String script, NSURL sourceURL)Evaluate a string of JavaScript code, with a URL for the script's source file.JSValueexception()[@property] Theexceptionproperty may be used to throw an exception to JavaScript.JSContext.Block_exceptionHandler_retexceptionHandler()[@property] If a call to an API function results in an uncaught JavaScript exception, theexceptionHandlerblock will be invoked.JSValueglobalObject()[@property] Get the global object of the context.static longhash_static()JSContextinit()[@methodgroup] Creating New JSContexts Create a JSContext.JSContextinitWithVirtualMachine(JSVirtualMachine virtualMachine)Create a JSContext in the specified virtual machine.static NSObject.Function_instanceMethodForSelector_retinstanceMethodForSelector(org.moe.natj.objc.SEL aSelector)static NSMethodSignatureinstanceMethodSignatureForSelector(org.moe.natj.objc.SEL aSelector)static booleaninstancesRespondToSelector(org.moe.natj.objc.SEL aSelector)static booleanisSubclassOfClass(org.moe.natj.objc.Class aClass)JSGlobalContextRefJSGlobalContextRef()[@property] Get the C API counterpart wrapped by a JSContext.static NSSet<java.lang.String>keyPathsForValuesAffectingValueForKey(java.lang.String key)java.lang.Stringname()[@property] Name of the JSContext.static java.lang.Objectnew_objc()JSValueobjectForKeyedSubscript(java.lang.Object key)Get a particular property on the global object.static booleanresolveClassMethod(org.moe.natj.objc.SEL sel)static booleanresolveInstanceMethod(org.moe.natj.objc.SEL sel)voidsetException(JSValue value)[@property] Theexceptionproperty may be used to throw an exception to JavaScript.voidsetExceptionHandler(JSContext.Block_setExceptionHandler value)[@property] If a call to an API function results in an uncaught JavaScript exception, theexceptionHandlerblock will be invoked.voidsetName(java.lang.String value)[@property] Name of the JSContext.voidsetObjectForKeyedSubscript(java.lang.Object object, NSObject key)Set a particular property on the global object.static voidsetVersion_static(long aVersion)static org.moe.natj.objc.Classsuperclass_static()static longversion_static()JSVirtualMachinevirtualMachine()[@property] All instances of JSContext are associated with a JSVirtualMachine.-
Methods inherited from class apple.NSObject
accessibilityActivate, accessibilityActivationPoint, accessibilityAssistiveTechnologyFocusedIdentifiers, accessibilityAttributedHint, accessibilityAttributedLabel, accessibilityAttributedUserInputLabels, accessibilityAttributedValue, accessibilityContainerType, accessibilityCustomActions, accessibilityCustomRotors, accessibilityDecrement, accessibilityDragSourceDescriptors, accessibilityDropPointDescriptors, accessibilityElementAtIndex, accessibilityElementCount, accessibilityElementDidBecomeFocused, accessibilityElementDidLoseFocus, accessibilityElementIsFocused, accessibilityElements, accessibilityElementsHidden, accessibilityFrame, accessibilityHint, accessibilityIncrement, accessibilityLabel, accessibilityLanguage, accessibilityNavigationStyle, accessibilityPath, accessibilityPerformEscape, accessibilityPerformMagicTap, accessibilityRespondsToUserInteraction, accessibilityScroll, accessibilityTextualContext, accessibilityTraits, accessibilityUserInputLabels, accessibilityValue, accessibilityViewIsModal, addObserverForKeyPathOptionsContext, attemptRecoveryFromErrorOptionIndex, attemptRecoveryFromErrorOptionIndexDelegateDidRecoverSelectorContextInfo, autoContentAccessingProxy, awakeAfterUsingCoder, awakeFromNib, class_objc, classForCoder, classForKeyedArchiver, copy, dealloc, debugDescription, description, dictionaryWithValuesForKeys, didChangeValueForKey, didChangeValueForKeyWithSetMutationUsingObjects, didChangeValuesAtIndexesForKey, doesNotRecognizeSelector, fileManagerShouldProceedAfterError, fileManagerWillProcessPath, finalize_objc, forwardingTargetForSelector, forwardInvocation, hash, indexOfAccessibilityElement, isAccessibilityElement, isEqual, isKindOfClass, isMemberOfClass, isProxy, methodForSelector, methodSignatureForSelector, mutableArrayValueForKey, mutableArrayValueForKeyPath, mutableCopy, mutableOrderedSetValueForKey, mutableOrderedSetValueForKeyPath, mutableSetValueForKey, mutableSetValueForKeyPath, observationInfo, observeValueForKeyPathOfObjectChangeContext, performSelector, performSelectorInBackgroundWithObject, performSelectorOnMainThreadWithObjectWaitUntilDone, performSelectorOnMainThreadWithObjectWaitUntilDoneModes, performSelectorOnThreadWithObjectWaitUntilDone, performSelectorOnThreadWithObjectWaitUntilDoneModes, performSelectorWithObject, performSelectorWithObjectAfterDelay, performSelectorWithObjectAfterDelayInModes, performSelectorWithObjectWithObject, prepareForInterfaceBuilder, provideImageDataBytesPerRowOrigin_Size_UserInfo, removeObserverForKeyPath, removeObserverForKeyPathContext, replacementObjectForCoder, replacementObjectForKeyedArchiver, respondsToSelector, self, setAccessibilityActivationPoint, setAccessibilityAttributedHint, setAccessibilityAttributedLabel, setAccessibilityAttributedUserInputLabels, setAccessibilityAttributedValue, setAccessibilityContainerType, setAccessibilityCustomActions, setAccessibilityCustomRotors, setAccessibilityDragSourceDescriptors, setAccessibilityDropPointDescriptors, setAccessibilityElements, setAccessibilityElementsHidden, setAccessibilityFrame, setAccessibilityHint, setAccessibilityLabel, setAccessibilityLanguage, setAccessibilityNavigationStyle, setAccessibilityPath, setAccessibilityRespondsToUserInteraction, setAccessibilityTextualContext, setAccessibilityTraits, setAccessibilityUserInputLabels, setAccessibilityValue, setAccessibilityViewIsModal, setIsAccessibilityElement, setNilValueForKey, setObservationInfo, setShouldGroupAccessibilityChildren, setValueForKey, setValueForKeyPath, setValueForUndefinedKey, setValuesForKeysWithDictionary, shouldGroupAccessibilityChildren, superclass, validateValueForKeyError, validateValueForKeyPathError, valueForKey, valueForKeyPath, valueForUndefinedKey, willChangeValueForKey, willChangeValueForKeyWithSetMutationUsingObjects, willChangeValuesAtIndexesForKey
-
-
-
-
Method Detail
-
accessInstanceVariablesDirectly
public static boolean accessInstanceVariablesDirectly()
-
alloc
public static JSContext alloc()
-
allocWithZone
public static java.lang.Object allocWithZone(org.moe.natj.general.ptr.VoidPtr zone)
-
automaticallyNotifiesObserversForKey
public static boolean automaticallyNotifiesObserversForKey(java.lang.String key)
-
cancelPreviousPerformRequestsWithTarget
public static void cancelPreviousPerformRequestsWithTarget(java.lang.Object aTarget)
-
cancelPreviousPerformRequestsWithTargetSelectorObject
public static void cancelPreviousPerformRequestsWithTargetSelectorObject(java.lang.Object aTarget, org.moe.natj.objc.SEL aSelector, java.lang.Object anArgument)
-
classFallbacksForKeyedArchiver
public static NSArray<java.lang.String> classFallbacksForKeyedArchiver()
-
classForKeyedUnarchiver
public static org.moe.natj.objc.Class classForKeyedUnarchiver()
-
contextWithJSGlobalContextRef
public static JSContext contextWithJSGlobalContextRef(JSGlobalContextRef jsGlobalContextRef)
Create a JSContext, wrapping its C API counterpart.- Returns:
- The JSContext equivalent of the provided JSGlobalContextRef.
-
currentArguments
public static NSArray<?> currentArguments()
Get the arguments to the current callback. This method may be called from within an Objective-C block or method invoked as a callback from JavaScript to retrieve the callback's arguments, objects in the returned array are instances of JSValue. Outside of a callback from JavaScript this method will return nil.- Returns:
- An NSArray of the arguments nil if there is no current callback.
-
currentCallee
public static JSValue currentCallee()
Get the JavaScript function that is currently executing. This method may be called from within an Objective-C block or method invoked as a callback from JavaScript to retrieve the callback's context. Outside of a callback from JavaScript this method will return nil.- Returns:
- The currently executing JavaScript function or nil if there isn't one.
-
currentContext
public static JSContext currentContext()
[@methodgroup] Callback Accessors Get the JSContext that is currently executing. This method may be called from within an Objective-C block or method invoked as a callback from JavaScript to retrieve the callback's context. Outside of a callback from JavaScript this method will return nil.- Returns:
- The currently executing JSContext or nil if there isn't one.
-
currentThis
public static JSValue currentThis()
Get thethisvalue of the currently executing method. This method may be called from within an Objective-C block or method invoked as a callback from JavaScript to retrieve the callback's this value. Outside of a callback from JavaScript this method will return nil.- Returns:
- The current
thisvalue or nil if there isn't one.
-
debugDescription_static
public static java.lang.String debugDescription_static()
-
description_static
public static java.lang.String description_static()
-
hash_static
public static long hash_static()
-
instanceMethodForSelector
public static NSObject.Function_instanceMethodForSelector_ret instanceMethodForSelector(org.moe.natj.objc.SEL aSelector)
-
instanceMethodSignatureForSelector
public static NSMethodSignature instanceMethodSignatureForSelector(org.moe.natj.objc.SEL aSelector)
-
instancesRespondToSelector
public static boolean instancesRespondToSelector(org.moe.natj.objc.SEL aSelector)
-
isSubclassOfClass
public static boolean isSubclassOfClass(org.moe.natj.objc.Class aClass)
-
keyPathsForValuesAffectingValueForKey
public static NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey(java.lang.String key)
-
new_objc
public static java.lang.Object new_objc()
-
resolveClassMethod
public static boolean resolveClassMethod(org.moe.natj.objc.SEL sel)
-
resolveInstanceMethod
public static boolean resolveInstanceMethod(org.moe.natj.objc.SEL sel)
-
setVersion_static
public static void setVersion_static(long aVersion)
-
superclass_static
public static org.moe.natj.objc.Class superclass_static()
-
version_static
public static long version_static()
-
JSGlobalContextRef
public JSGlobalContextRef JSGlobalContextRef()
[@property] Get the C API counterpart wrapped by a JSContext.- Returns:
- The C API equivalent of this JSContext.
-
evaluateScript
public JSValue evaluateScript(java.lang.String script)
[@methodgroup] Evaluating Scripts Evaluate a string of JavaScript code.- Parameters:
script- A string containing the JavaScript code to evaluate.- Returns:
- The last value generated by the script.
-
evaluateScriptWithSourceURL
public JSValue evaluateScriptWithSourceURL(java.lang.String script, NSURL sourceURL)
Evaluate a string of JavaScript code, with a URL for the script's source file.- Parameters:
script- A string containing the JavaScript code to evaluate.sourceURL- A URL for the script's source file. Used by debuggers and when reporting exceptions. This parameter is informative only: it does not change the behavior of the script.- Returns:
- The last value generated by the script.
-
exception
public JSValue exception()
[@property] Theexceptionproperty 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 ofexceptionHandleris to assign an uncaught exception to this property).
-
exceptionHandler
public JSContext.Block_exceptionHandler_ret exceptionHandler()
[@property] If a call to an API function results in an uncaught JavaScript exception, theexceptionHandlerblock 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.
-
globalObject
public JSValue globalObject()
[@property] Get the global object of the context. 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.- Returns:
- The global object.
-
init
public JSContext init()
[@methodgroup] Creating New JSContexts Create a JSContext.
-
initWithVirtualMachine
public JSContext initWithVirtualMachine(JSVirtualMachine virtualMachine)
Create a JSContext in the specified virtual machine.- Parameters:
virtualMachine- The JSVirtualMachine in which the context will be created.- Returns:
- The new context.
-
name
public java.lang.String name()
[@property] Name of the JSContext. Exposed when remote debugging the context.
-
objectForKeyedSubscript
public JSValue objectForKeyedSubscript(java.lang.Object key)
Get a particular property on the global object.- Returns:
- The JSValue for the global object's property.
-
setException
public void setException(JSValue value)
[@property] Theexceptionproperty 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 ofexceptionHandleris to assign an uncaught exception to this property).
-
setExceptionHandler
public void setExceptionHandler(JSContext.Block_setExceptionHandler value)
[@property] If a call to an API function results in an uncaught JavaScript exception, theexceptionHandlerblock 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.
-
setName
public void setName(java.lang.String value)
[@property] Name of the JSContext. Exposed when remote debugging the context.
-
setObjectForKeyedSubscript
public void setObjectForKeyedSubscript(java.lang.Object object, NSObject key)Set a particular property on the global object.
-
virtualMachine
public JSVirtualMachine virtualMachine()
[@property] All instances of JSContext are associated with a JSVirtualMachine.
-
-