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<
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' ; 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: [" ; ramOnlyKey" ; , " ; ramOnlyCollection_" ; ]</p >
72- <ul >
73- <li ><code >isRamOnlyKey(" ; ramOnlyKey" ; )</code > would return true</li >
74- <li ><code >isRamOnlyKey(" ; ramOnlyCollection_" ; )</code > would return true</li >
75- <li ><code >isRamOnlyKey(" ; ramOnlyCollection_1" ; )</code > would return true</li >
76- <li ><code >isRamOnlyKey(" ; someOtherKey" ; )</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 " ; collection key" ; )</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(" ; report_123" ; )</code > would return " ; report_" ; </li >
91- <li ><code >getCollectionKey(" ; report_" ; )</code > would return " ; report_" ; </li >
92- <li ><code >getCollectionKey(" ; report_-1_something" ; )</code > would return " ; report_" ; </li >
93- <li ><code >getCollectionKey(" ; sharedNVP_user_-1_something" ; )</code > would return " ; sharedNVP_user_" ; </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.
9864If the requested key is a collection, it will return an object with all the collection members.</p >
@@ -113,17 +79,6 @@ run out of storage the least recently accessed key can be removed.</p>
11379<dt ><a href =" #getCollectionDataAndSendAsObject " >getCollectionDataAndSendAsObject()</a ></dt >
11480<dd ><p >Gets the data for a given an array of matching keys, combines them into an object, and sends the result back to the subscriber.</p >
11581</dd >
116- <dt ><a href =" #prepareSubscriberUpdate " >prepareSubscriberUpdate(callback)</a ></dt >
117- <dd ><p >Delays promise resolution until the next macrotask to prevent race condition if the key subscription is in progress.</p >
118- </dd >
119- <dt ><a href =" #scheduleSubscriberUpdate " >scheduleSubscriberUpdate()</a ></dt >
120- <dd ><p >Schedules an update that will be appended to the macro task queue (so it doesn' ; t update the subscribers immediately).</p >
121- </dd >
122- <dt ><a href =" #scheduleNotifyCollectionSubscribers " >scheduleNotifyCollectionSubscribers()</a ></dt >
123- <dd ><p >This method is similar to scheduleSubscriberUpdate but it is built for working specifically with collections
124- so that keysChanged() is triggered for the collection and not keyChanged(). If this was not done, then the
125- subscriber callbacks receive the data in a different format than they normally expect and it breaks code.</p >
126- </dd >
12782<dt ><a href =" #remove " >remove()</a ></dt >
12883<dd ><p >Remove a key from Onyx and update the subscribers</p >
12984</dd >
@@ -223,6 +178,20 @@ Getter - returns the default key states.
223178Getter - returns the deffered init task.
224179
225180** Kind** : global function
181+ <a name =" afterInit " ></a >
182+
183+ ## afterInit(action) ⇒
184+ Executes an action after Onyx has been initialized.
185+ If Onyx is already initialized, the action is executed immediately.
186+ Otherwise, it waits for initialization to complete before executing.
187+
188+ ** Kind** : global function
189+ ** Returns** : The result of the action
190+
191+ | Param | Description |
192+ | --- | --- |
193+ | action | The action to execute after initialization |
194+
226195<a name =" getSkippableCollectionMemberIDs " ></a >
227196
228197## getSkippableCollectionMemberIDs()
@@ -312,93 +281,6 @@ Deletes a subscription ID associated with its corresponding key.
312281Returns current key names stored in persisted storage
313282
314283** 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-
402284<a name =" tryGetCachedValue " ></a >
403285
404286## tryGetCachedValue()
@@ -457,35 +339,6 @@ run out of storage the least recently accessed key can be removed.
457339## getCollectionDataAndSendAsObject()
458340Gets the data for a given an array of matching keys, combines them into an object, and sends the result back to the subscriber.
459341
460- ** Kind** : global function
461- <a name =" prepareSubscriberUpdate " ></a >
462-
463- ## prepareSubscriberUpdate(callback)
464- Delays promise resolution until the next macrotask to prevent race condition if the key subscription is in progress.
465-
466- ** Kind** : global function
467-
468- | Param | Description |
469- | --- | --- |
470- | callback | The keyChanged/keysChanged callback |
471-
472- <a name =" scheduleSubscriberUpdate " ></a >
473-
474- ## scheduleSubscriberUpdate()
475- Schedules an update that will be appended to the macro task queue (so it doesn't update the subscribers immediately).
476-
477- ** Kind** : global function
478- ** Example**
479- ``` js
480- scheduleSubscriberUpdate (key, value, subscriber => subscriber .initWithStoredValues === false )
481- ```
482- <a name =" scheduleNotifyCollectionSubscribers " ></a >
483-
484- ## scheduleNotifyCollectionSubscribers()
485- This method is similar to scheduleSubscriberUpdate but it is built for working specifically with collections
486- so that keysChanged() is triggered for the collection and not keyChanged(). If this was not done, then the
487- subscriber callbacks receive the data in a different format than they normally expect and it breaks code.
488-
489342** Kind** : global function
490343<a name =" remove " ></a >
491344
0 commit comments