Skip to content

Commit cd7cbbb

Browse files
committed
Update docs
1 parent 32f88a9 commit cd7cbbb

1 file changed

Lines changed: 19 additions & 126 deletions

File tree

API-INTERNAL.md

Lines changed: 19 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
<dt><a href="#getDeferredInitTask">getDeferredInitTask()</a></dt>
1818
<dd><p>Getter - returns the deffered init task.</p>
1919
</dd>
20+
<dt><a href="#afterInit">afterInit(action)</a> ⇒</dt>
21+
<dd><p>Executes an action after Onyx has been initialized.
22+
If Onyx is already initialized, the action is executed immediately.
23+
Otherwise, it waits for initialization to complete before executing.</p>
24+
</dd>
2025
<dt><a href="#getSkippableCollectionMemberIDs">getSkippableCollectionMemberIDs()</a></dt>
2126
<dd><p>Getter - returns the skippable collection member IDs.</p>
2227
</dd>
@@ -54,45 +59,6 @@ to the values for those keys (correctly typed) such as <code>[OnyxCollection&lt;
5459
<dt><a href="#getAllKeys">getAllKeys()</a></dt>
5560
<dd><p>Returns current key names stored in persisted storage</p>
5661
</dd>
57-
<dt><a href="#getCollectionKeys">getCollectionKeys()</a></dt>
58-
<dd><p>Returns set of all registered collection keys</p>
59-
</dd>
60-
<dt><a href="#isCollectionKey">isCollectionKey()</a></dt>
61-
<dd><p>Checks to see if the subscriber&#39;s supplied key
62-
is associated with a collection of keys.</p>
63-
</dd>
64-
<dt><a href="#isCollectionMember">isCollectionMember(key)</a> ⇒</dt>
65-
<dd><p>Checks if a given key is a collection member key (not just a collection key).</p>
66-
</dd>
67-
<dt><a href="#isRamOnlyKey">isRamOnlyKey(key)</a> ⇒</dt>
68-
<dd><p>Checks if a given key is a RAM-only key, RAM-only collection key, or a RAM-only collection member</p>
69-
<p>For example:</p>
70-
<p>For the following Onyx setup</p>
71-
<p>ramOnlyKeys: [&quot;ramOnlyKey&quot;, &quot;ramOnlyCollection_&quot;]</p>
72-
<ul>
73-
<li><code>isRamOnlyKey(&quot;ramOnlyKey&quot;)</code> would return true</li>
74-
<li><code>isRamOnlyKey(&quot;ramOnlyCollection_&quot;)</code> would return true</li>
75-
<li><code>isRamOnlyKey(&quot;ramOnlyCollection_1&quot;)</code> would return true</li>
76-
<li><code>isRamOnlyKey(&quot;someOtherKey&quot;)</code> would return false</li>
77-
</ul>
78-
</dd>
79-
<dt><a href="#splitCollectionMemberKey">splitCollectionMemberKey(key, collectionKey)</a> ⇒</dt>
80-
<dd><p>Splits a collection member key into the collection key part and the ID part.</p>
81-
</dd>
82-
<dt><a href="#isKeyMatch">isKeyMatch()</a></dt>
83-
<dd><p>Checks to see if a provided key is the exact configured key of our connected subscriber
84-
or if the provided key is a collection member key (in case our configured key is a &quot;collection key&quot;)</p>
85-
</dd>
86-
<dt><a href="#getCollectionKey">getCollectionKey(key)</a> ⇒</dt>
87-
<dd><p>Extracts the collection identifier of a given collection member key.</p>
88-
<p>For example:</p>
89-
<ul>
90-
<li><code>getCollectionKey(&quot;report_123&quot;)</code> would return &quot;report_&quot;</li>
91-
<li><code>getCollectionKey(&quot;report_&quot;)</code> would return &quot;report_&quot;</li>
92-
<li><code>getCollectionKey(&quot;report_-1_something&quot;)</code> would return &quot;report_&quot;</li>
93-
<li><code>getCollectionKey(&quot;sharedNVP_user_-1_something&quot;)</code> would return &quot;sharedNVP_user_&quot;</li>
94-
</ul>
95-
</dd>
9662
<dt><a href="#tryGetCachedValue">tryGetCachedValue()</a></dt>
9763
<dd><p>Tries to get a value from the cache. If the value is not present in cache it will return the default value or undefined.
9864
If the requested key is a collection, it will return an object with all the collection members.</p>
@@ -223,6 +189,20 @@ Getter - returns the default key states.
223189
Getter - returns the deffered init task.
224190

225191
**Kind**: global function
192+
<a name="afterInit"></a>
193+
194+
## afterInit(action) ⇒
195+
Executes an action after Onyx has been initialized.
196+
If Onyx is already initialized, the action is executed immediately.
197+
Otherwise, it waits for initialization to complete before executing.
198+
199+
**Kind**: global function
200+
**Returns**: The result of the action
201+
202+
| Param | Description |
203+
| --- | --- |
204+
| action | The action to execute after initialization |
205+
226206
<a name="getSkippableCollectionMemberIDs"></a>
227207

228208
## getSkippableCollectionMemberIDs()
@@ -312,93 +292,6 @@ Deletes a subscription ID associated with its corresponding key.
312292
Returns current key names stored in persisted storage
313293

314294
**Kind**: global function
315-
<a name="getCollectionKeys"></a>
316-
317-
## getCollectionKeys()
318-
Returns set of all registered collection keys
319-
320-
**Kind**: global function
321-
<a name="isCollectionKey"></a>
322-
323-
## isCollectionKey()
324-
Checks to see if the subscriber's supplied key
325-
is associated with a collection of keys.
326-
327-
**Kind**: global function
328-
<a name="isCollectionMember"></a>
329-
330-
## isCollectionMember(key) ⇒
331-
Checks if a given key is a collection member key (not just a collection key).
332-
333-
**Kind**: global function
334-
**Returns**: true if the key is a collection member, false otherwise
335-
336-
| Param | Description |
337-
| --- | --- |
338-
| key | The key to check |
339-
340-
<a name="isRamOnlyKey"></a>
341-
342-
## isRamOnlyKey(key) ⇒
343-
Checks if a given key is a RAM-only key, RAM-only collection key, or a RAM-only collection member
344-
345-
For example:
346-
347-
For the following Onyx setup
348-
349-
ramOnlyKeys: ["ramOnlyKey", "ramOnlyCollection_"]
350-
351-
- `isRamOnlyKey("ramOnlyKey")` would return true
352-
- `isRamOnlyKey("ramOnlyCollection_")` would return true
353-
- `isRamOnlyKey("ramOnlyCollection_1")` would return true
354-
- `isRamOnlyKey("someOtherKey")` would return false
355-
356-
**Kind**: global function
357-
**Returns**: true if key is a RAM-only key, RAM-only collection key, or a RAM-only collection member
358-
359-
| Param | Description |
360-
| --- | --- |
361-
| key | The key to check |
362-
363-
<a name="splitCollectionMemberKey"></a>
364-
365-
## splitCollectionMemberKey(key, collectionKey) ⇒
366-
Splits a collection member key into the collection key part and the ID part.
367-
368-
**Kind**: global function
369-
**Returns**: A tuple where the first element is the collection part and the second element is the ID part,
370-
or throws an Error if the key is not a collection one.
371-
372-
| Param | Description |
373-
| --- | --- |
374-
| key | The collection member key to split. |
375-
| collectionKey | The collection key of the `key` param that can be passed in advance to optimize the function. |
376-
377-
<a name="isKeyMatch"></a>
378-
379-
## isKeyMatch()
380-
Checks to see if a provided key is the exact configured key of our connected subscriber
381-
or if the provided key is a collection member key (in case our configured key is a "collection key")
382-
383-
**Kind**: global function
384-
<a name="getCollectionKey"></a>
385-
386-
## getCollectionKey(key) ⇒
387-
Extracts the collection identifier of a given collection member key.
388-
389-
For example:
390-
- `getCollectionKey("report_123")` would return "report_"
391-
- `getCollectionKey("report_")` would return "report_"
392-
- `getCollectionKey("report_-1_something")` would return "report_"
393-
- `getCollectionKey("sharedNVP_user_-1_something")` would return "sharedNVP_user_"
394-
395-
**Kind**: global function
396-
**Returns**: The plain collection key or throws an Error if the key is not a collection one.
397-
398-
| Param | Description |
399-
| --- | --- |
400-
| key | The collection key to process. |
401-
402295
<a name="tryGetCachedValue"></a>
403296

404297
## tryGetCachedValue()

0 commit comments

Comments
 (0)