|
20 | 20 | * @since v5.0.0 |
21 | 21 | */ |
22 | 22 | /// mergeable-store |
| 23 | + |
| 24 | +/** |
| 25 | + * The GetNow type is used to represent a function that returns the current time |
| 26 | + * in milliseconds. |
| 27 | + * |
| 28 | + * This is used internally within the mergeable-store module, but is used for |
| 29 | + * the createMergeableStore function's second optional argument to allow |
| 30 | + * applications to override the clock used to generate timestamps. |
| 31 | + * @category Stamps |
| 32 | + * @since v6.1.0 |
| 33 | + */ |
| 34 | +/// GetNow |
| 35 | + |
23 | 36 | /** |
24 | 37 | * The Hash type is used within the mergeable-store module to quickly compare |
25 | 38 | * the content of two objects. |
|
953 | 966 | * The createMergeableStore function creates a MergeableStore, and is the main |
954 | 967 | * entry point into the mergeable-store module. |
955 | 968 | * |
956 | | - * There is one optional parameter which is a uniqueId for the MergeableStore. |
957 | | - * This is used to distinguish conflicting changes made in the same millisecond |
958 | | - * by two different MergeableStore objects as its hash is added to the end of |
959 | | - * the HLC timestamps. Generally this can be omitted unless you have a need for |
960 | | - * deterministic HLCs, such as in a testing scenario. Otherwise, TinyBase will |
961 | | - * assign a unique Id to the Store at the time of creation. |
| 969 | + * There are two optional parameters which are only for testing and advanced |
| 970 | + * usage. |
| 971 | + * |
| 972 | + * The first is a uniqueId for the MergeableStore, used to distinguish |
| 973 | + * conflicting changes made in the same millisecond by two different |
| 974 | + * MergeableStore objects as its hash is added to the end of the HLC timestamps. |
| 975 | + * Generally this can be omitted unless you have a need for deterministic HLCs, |
| 976 | + * such as in a testing scenario. Otherwise, TinyBase will assign a unique Id to |
| 977 | + * the Store at the time of creation. |
| 978 | + * |
| 979 | + * Since v6.1.0, the second is a function that can be used to replace the way |
| 980 | + * the timestamp is generated for HLCs (by default JavaScript's `Date.now()` |
| 981 | + * method). |
| 982 | + * @param uniqueId An optional unique Id for the MergeableStore. |
| 983 | + * @param getNow An optional function that generates millisecond timestamps. |
962 | 984 | * @returns A reference to the new MergeableStore. |
963 | 985 | * @example |
964 | 986 | * This example creates a MergeableStore. |
|
0 commit comments