---
title: JSObjectGetPropertyCallback
framework: javascriptcore
role: symbol
role_heading: Type Alias
path: javascriptcore/jsobjectgetpropertycallback
---

# JSObjectGetPropertyCallback

The callback type for getting a property’s value.

## Declaration

```swift
typealias JSObjectGetPropertyCallback = (JSContextRef?, JSObjectRef?, JSStringRef?, UnsafeMutablePointer<JSValueRef?>?) -> JSValueRef?
```

## Parameters

- `ctx`: The execution context to use.
- `object`: The doc://com.apple.javascriptcore/documentation/JavaScriptCore/JSObjectRef to search for the property.
- `propertyName`: A doc://com.apple.javascriptcore/documentation/JavaScriptCore/JSStringRef that contains the name of the property to get.
- `exception`: A pointer to a doc://com.apple.javascriptcore/documentation/JavaScriptCore/JSValueRef to return an exception in, if any.

## Return Value

Return Value The property’s value if the object has the property; otherwise, NULL.

## Discussion

Discussion If you name your function GetProperty, you declare it like this: JSValueRef GetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception); If this function returns NULL, the get request forwards to the object’s statically declared properties, then its parent class chain (which includes the default object class), and then its prototype chain.

## See Also

### Managing Callbacks

- [initialize](javascriptcore/jsclassdefinition/initialize.md)
- [JSObjectInitializeCallback](javascriptcore/jsobjectinitializecallback.md)
- [finalize](javascriptcore/jsclassdefinition/finalize.md)
- [JSObjectFinalizeCallback](javascriptcore/jsobjectfinalizecallback.md)
- [hasProperty](javascriptcore/jsclassdefinition/hasproperty.md)
- [JSObjectHasPropertyCallback](javascriptcore/jsobjecthaspropertycallback.md)
- [getProperty](javascriptcore/jsclassdefinition/getproperty.md)
- [setProperty](javascriptcore/jsclassdefinition/setproperty.md)
- [JSObjectSetPropertyCallback](javascriptcore/jsobjectsetpropertycallback.md)
- [deleteProperty](javascriptcore/jsclassdefinition/deleteproperty.md)
- [JSObjectDeletePropertyCallback](javascriptcore/jsobjectdeletepropertycallback.md)
- [getPropertyNames](javascriptcore/jsclassdefinition/getpropertynames.md)
- [JSObjectGetPropertyNamesCallback](javascriptcore/jsobjectgetpropertynamescallback.md)
- [callAsFunction](javascriptcore/jsclassdefinition/callasfunction.md)
- [JSObjectCallAsFunctionCallback](javascriptcore/jsobjectcallasfunctioncallback.md)
