Skip to content

Commit 69f4ef1

Browse files
committed
Documentation
1 parent f3a7c18 commit 69f4ef1

File tree

1 file changed

+37
-10
lines changed

1 file changed

+37
-10
lines changed

JavaScriptCore/API/JSTypedArray.h

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ typedef enum {
4141
@abstract Returns a JavaScript value's Typed Array type
4242
@param ctx The execution context to use.
4343
@param value The JSValue whose Typed Array type you want to obtain.
44-
@result A value of type JSTypedArrayType that identifies value's Typed Array type.
44+
@result A value of type JSTypedArrayType that identifies value's Typed Array type, or kJSTypedArrayTypeNone if the object is not a Typed Array.
4545
*/
4646
JS_EXPORT JSTypedArrayType JSObjectGetTypedArrayType(JSContextRef ctx, JSObjectRef object);
4747

@@ -55,23 +55,50 @@ JS_EXPORT JSTypedArrayType JSObjectGetTypedArrayType(JSContextRef ctx, JSObjectR
5555
*/
5656
JS_EXPORT JSObjectRef JSObjectMakeTypedArray(JSContextRef ctx, JSTypedArrayType arrayType, size_t numElements);
5757

58-
58+
/*! @typedef JSDataRef A Typed Array data buffer. */
5959
typedef struct OpaqueJSData* JSDataRef;
6060

61-
JS_EXPORT void JSDataRetain(JSDataRef data);
61+
/*!
62+
@function
63+
@abstract Returns a retained JSDataRef that encapsulates a pointer to a Typed Array's data in memory
64+
@param ctx The execution context to use.
65+
@param value The JSObjectRef whose Typed Array type data pointer you want to obtain.
66+
@result A JSDataRef or NULL if the JSObjectRef is not a Typed Array. The return value is automatically retained and has to be released again with JSDataRelease
67+
*/
68+
JS_EXPORT JSDataRef JSObjectGetRetainedTypedArrayData(JSContextRef ctx, JSObjectRef object);
69+
70+
/*!
71+
@function
72+
@abstract Retains a JavaScript data object.
73+
@param data The JSData to retain.
74+
@result A JSDataRef that is the same as data.
75+
*/
76+
JS_EXPORT JSDataRef JSDataRetain(JSDataRef data);
77+
78+
/*!
79+
@function
80+
@abstract Releases a JavaScript data object.
81+
@param data The JSData to release.
82+
*/
6283
JS_EXPORT void JSDataRelease(JSDataRef data);
84+
85+
/*!
86+
@function
87+
@abstract Returns a pointer to the data buffer that serves as the backing store for a JavaScript data object.
88+
@param data The JSData whose backing store you want to access.
89+
@result A pointer to the raw data buffer that serves as data's backing store, which will be deallocated when the data is deallocated.
90+
*/
6391
JS_EXPORT void * JSDataGetBytesPtr(JSDataRef data);
64-
JS_EXPORT size_t JSDataGetLength(JSDataRef data);
6592

6693
/*!
6794
@function
68-
@abstract Returns a pointer to a Typed Array's data in memory
69-
@param ctx The execution context to use.
70-
@param value The JSValue whose Typed Array type data pointer you want to obtain.
71-
@param byteLength A pointer to a size_t in which to store the byte length of the Typed Array
72-
@result A pointer to the Typed Array's data or NULL if the JSValue is not a Typed Array.
95+
@abstract Returns the number of bytes in a JavaScript data object.
96+
@param data The JSData whose length (in bytes) you want to know.
97+
@result The number of bytes stored in the data object.
7398
*/
74-
JS_EXPORT JSDataRef JSObjectGetRetainedTypedArrayData(JSContextRef ctx, JSObjectRef object);
99+
JS_EXPORT size_t JSDataGetLength(JSDataRef data);
100+
101+
75102

76103

77104
#ifdef __cplusplus

0 commit comments

Comments
 (0)