diff --git a/API-INTERNAL.md b/API-INTERNAL.md index 4381fede..bb1c647b 100644 --- a/API-INTERNAL.md +++ b/API-INTERNAL.md @@ -11,9 +11,6 @@
getMergeQueuePromise()

Getter - returns the merge queue promise.

-
getCallbackToStateMapping()
-

Getter - returns the callback to state mapping.

-
getDefaultKeyStates()

Getter - returns the default key states.

@@ -171,12 +168,6 @@ Getter - returns the merge queue. ## getMergeQueuePromise() Getter - returns the merge queue promise. -**Kind**: global function - - -## getCallbackToStateMapping() -Getter - returns the callback to state mapping. - **Kind**: global function diff --git a/API.md b/API.md index e18a0027..a6287849 100644 --- a/API.md +++ b/API.md @@ -69,6 +69,13 @@ Connects to an Onyx key given the options passed and listens to its changes. | Param | Description | | --- | --- | | connectOptions | The options object that will define the behavior of the connection. | +| connectOptions.key | The Onyx key to subscribe to. | +| connectOptions.callback | A function that will be called when the Onyx data we are subscribed changes. | +| connectOptions.waitForCollectionCallback | If set to `true`, it will return the entire collection to the callback as a single object. | +| connectOptions.withOnyxInstance | The `withOnyx` class instance to be internally passed. **Only used inside `withOnyx()` HOC.** | +| connectOptions.statePropertyName | The name of the component's prop that is connected to the Onyx key. **Only used inside `withOnyx()` HOC.** | +| connectOptions.displayName | The component's display name. **Only used inside `withOnyx()` HOC.** | +| connectOptions.selector | This will be used to subscribe to a subset of an Onyx key's data. **Only used inside `useOnyx()` hook or `withOnyx()` HOC.** Using this setting on `useOnyx()` or `withOnyx()` can have very positive performance benefits because the component will only re-render when the subset of data changes. Otherwise, any change of data on any property would normally cause the component to re-render (and that can be expensive from a performance standpoint). | **Example** ```ts diff --git a/lib/Onyx.ts b/lib/Onyx.ts index a08a5084..88be4a2f 100644 --- a/lib/Onyx.ts +++ b/lib/Onyx.ts @@ -77,6 +77,16 @@ function init({ * ``` * * @param connectOptions The options object that will define the behavior of the connection. + * @param connectOptions.key The Onyx key to subscribe to. + * @param connectOptions.callback A function that will be called when the Onyx data we are subscribed changes. + * @param connectOptions.waitForCollectionCallback If set to `true`, it will return the entire collection to the callback as a single object. + * @param connectOptions.withOnyxInstance The `withOnyx` class instance to be internally passed. **Only used inside `withOnyx()` HOC.** + * @param connectOptions.statePropertyName The name of the component's prop that is connected to the Onyx key. **Only used inside `withOnyx()` HOC.** + * @param connectOptions.displayName The component's display name. **Only used inside `withOnyx()` HOC.** + * @param connectOptions.selector This will be used to subscribe to a subset of an Onyx key's data. **Only used inside `useOnyx()` hook or `withOnyx()` HOC.** + * Using this setting on `useOnyx()` or `withOnyx()` can have very positive performance benefits because the component will only re-render + * when the subset of data changes. Otherwise, any change of data on any property would normally + * cause the component to re-render (and that can be expensive from a performance standpoint). * @returns The connection object to use when calling `Onyx.disconnect()`. */ function connect(connectOptions: ConnectOptions): Connection {