---
title: JSObjectGetPropertyNamesCallback
framework: javascriptcore
role: symbol
role_heading: Type Alias
path: javascriptcore/jsobjectgetpropertynamescallback
---

# JSObjectGetPropertyNamesCallback

The callback type for collecting the names of an object’s properties.

## Declaration

```swift
typealias JSObjectGetPropertyNamesCallback = (JSContextRef?, JSObjectRef?, JSPropertyNameAccumulatorRef?) -> Void
```

## Parameters

- `ctx`: The execution context to use.
- `object`: The doc://com.apple.javascriptcore/documentation/JavaScriptCore/JSObjectRef with the property names to collect.
- `accumulator`: A JavaScript property name accumulator to accumulate the names of the object’s properties in.

## Discussion

Discussion If you name your function GetPropertyNames, you declare it like this: void GetPropertyNames(JSContextRef ctx, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames); JSObjectCopyPropertyNames(_:_:) and JavaScript for-in loops use property name accumulators. Use JSPropertyNameAccumulatorAddName(_:_:) to add property names to accumulator. A class’s getPropertyNames callback only needs to provide the names of properties that the class vends through a custom getProperty or setProperty callback. The system adds other properties independently, including statically declared properties, properties that other classes vend, and properties that belong to the object’s prototype.

## 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)
- [JSObjectGetPropertyCallback](javascriptcore/jsobjectgetpropertycallback.md)
- [setProperty](javascriptcore/jsclassdefinition/setproperty.md)
- [JSObjectSetPropertyCallback](javascriptcore/jsobjectsetpropertycallback.md)
- [deleteProperty](javascriptcore/jsclassdefinition/deleteproperty.md)
- [JSObjectDeletePropertyCallback](javascriptcore/jsobjectdeletepropertycallback.md)
- [getPropertyNames](javascriptcore/jsclassdefinition/getpropertynames.md)
- [callAsFunction](javascriptcore/jsclassdefinition/callasfunction.md)
- [JSObjectCallAsFunctionCallback](javascriptcore/jsobjectcallasfunctioncallback.md)
