You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
</code></pre></section><section class="s7"><h6>Since</h6><p>v1.0.0</p></section></section><section class="s6" id="/api/persister-react-native-mmkv/interfaces/persister/reactnativemmkvpersister/methods/getter/getstoragename/" data-id="gSN3"><h6><code>getStorageName</code></h6><p>The <code>getStorageName</code> method returns the unique key of the storage location the <a href="#/api/the-essentials/creating-stores/store/"><code>Store</code></a> is being persisted to.</p><pre><code><span class="function"><a href="#/api/persister-browser/interfaces/persister/localpersister/methods/getter/getstoragename/">getStorageName</a></span><span class="punctuation">(</span><span class="punctuation">)</span><span class="operator">:</span> <span class="builtin">string</span></code></pre><div class="table"><table><tr><th class="right">returns</th><td><code><span class="builtin">string</span></code></td><td><p></p><p>The unique key of the storage location.</p><p></p></td></tr></table></div><section class="s7"><h6>Example</h6><p>This example creates a <a href="#/api/persisters/interfaces/persister/persister/"><code>Persister</code></a> object against a newly-created <a href="#/api/the-essentials/creating-stores/store/"><code>Store</code></a> and then gets the unique key of the storage location back out again.</p><pre><code><span class="keyword">import</span> <span class="punctuation">{</span><span class="constant">MMKV</span><span class="punctuation">}</span> <span class="keyword">from</span> <span class="string">'react-native-mmkv'</span><span class="punctuation">;</span>
18152
+
</code></pre></section><section class="s7"><h6>Since</h6><p>v1.0.0</p></section></section><section class="s6" id="/api/persister-react-native-mmkv/interfaces/persister/reactnativemmkvpersister/methods/getter/getstoragename/" data-id="gSN3"><h6><code>getStorageName</code></h6><p>The <code>getStorageName</code> method returns the unique key of the storage location the <a href="#/api/the-essentials/creating-stores/store/"><code>Store</code></a> is being persisted to.</p><pre><code><span class="function"><a href="#/api/persister-browser/interfaces/persister/localpersister/methods/getter/getstoragename/">getStorageName</a></span><span class="punctuation">(</span><span class="punctuation">)</span><span class="operator">:</span> <span class="builtin">string</span></code></pre><div class="table"><table><tr><th class="right">returns</th><td><code><span class="builtin">string</span></code></td><td><p></p><p>The unique key of the storage location.</p><p></p></td></tr></table></div><section class="s7"><h6>Example</h6><p>This example creates a <a href="#/api/persisters/interfaces/persister/persister/"><code>Persister</code></a> object against a newly-created <a href="#/api/the-essentials/creating-stores/store/"><code>Store</code></a> and then gets the unique key of the storage location back out again.</p><pre><code><span class="keyword">import</span> <span class="punctuation">{</span>createMMKV<span class="punctuation">}</span> <span class="keyword">from</span> <span class="string">'react-native-mmkv'</span><span class="punctuation">;</span>
<span class="punctuation">)</span><span class="operator">:</span> <span class="type"><a href="#/api/persister-react-native-mmkv/interfaces/persister/reactnativemmkvpersister/">ReactNativeMmkvPersister</a></span></code></pre><div class="table"><table><tr><th></th><th>Type</th><th>Description</th></tr><tr><th><code>store</code></th><td><code><span class="type"><a href="#/api/the-essentials/creating-stores/store/">Store</a></span> <span class="operator">|</span> <span class="type"><a href="#/api/mergeable-store/interfaces/mergeable/mergeablestore/">MergeableStore</a></span></code></td><td><p>The <a href="#/api/the-essentials/creating-stores/store/"><code>Store</code></a> or <a href="#/api/mergeable-store/interfaces/mergeable/mergeablestore/"><code>MergeableStore</code></a> to persist.</p></td></tr><tr><th><code>storage</code></th><td><code><span class="constant">MMKV</span></code></td><td><p>The MMKV storage instance.</p></td></tr><tr><th><code>storageName<span class="operator">?</span></code></th><td><code><span class="builtin">string</span></code></td><td><p>The unique key to identify the storage location.</p></td></tr><tr><th><code>onIgnoredError<span class="operator">?</span></code></th><td><code><span class="punctuation">(</span>error<span class="operator">:</span> <span class="builtin">any</span><span class="punctuation">)</span> <span class="operator">=></span> <span class="keyword">void</span></code></td><td><p>An optional handler for the errors that the <a href="#/api/the-essentials/persisting-stores/persister/"><code>Persister</code></a> would otherwise ignore when trying to save or load data. This is suitable for debugging persistence issues in a development environment.</p></td></tr><tr><th class="right">returns</th><td><code><span class="type"><a href="#/api/persister-react-native-mmkv/interfaces/persister/reactnativemmkvpersister/">ReactNativeMmkvPersister</a></span></code></td><td><p></p><p>A reference to the new <a href="#/api/persister-react-native-mmkv/interfaces/persister/reactnativemmkvpersister/"><code>ReactNativeMmkvPersister</code></a> object.</p><p></p></td></tr></table></div><p>A <a href="#/api/persister-react-native-mmkv/interfaces/persister/reactnativemmkvpersister/"><code>ReactNativeMmkvPersister</code></a> supports both regular <a href="#/api/the-essentials/creating-stores/store/"><code>Store</code></a> and <a href="#/api/mergeable-store/interfaces/mergeable/mergeablestore/"><code>MergeableStore</code></a> objects.</p><p>As well as providing a reference to the <a href="#/api/the-essentials/creating-stores/store/"><code>Store</code></a> to persist, you must provide a <code>storage</code> parameter which identifies the MMKV storage instance.</p><p>The third argument is a <code>storageName</code> string that configures which key to use for the storage key.</p><section class="s5"><h5>Example</h5><p>This example creates a <a href="#/api/persister-react-native-mmkv/interfaces/persister/reactnativemmkvpersister/"><code>ReactNativeMmkvPersister</code></a> object and persists the <a href="#/api/the-essentials/creating-stores/store/"><code>Store</code></a> to a MMKV storage instance as a JSON serialization into the <code>my_tinybase</code> key. It makes a change to the storage directly and then reloads it back into the <a href="#/api/the-essentials/creating-stores/store/"><code>Store</code></a>.</p><pre><code><span class="keyword">import</span> <span class="punctuation">{</span><span class="constant">MMKV</span><span class="punctuation">}</span> <span class="keyword">from</span> <span class="string">'react-native-mmkv'</span><span class="punctuation">;</span>
18466
+
<span class="punctuation">)</span><span class="operator">:</span> <span class="type"><a href="#/api/persister-react-native-mmkv/interfaces/persister/reactnativemmkvpersister/">ReactNativeMmkvPersister</a></span></code></pre><div class="table"><table><tr><th></th><th>Type</th><th>Description</th></tr><tr><th><code>store</code></th><td><code><span class="type"><a href="#/api/the-essentials/creating-stores/store/">Store</a></span> <span class="operator">|</span> <span class="type"><a href="#/api/mergeable-store/interfaces/mergeable/mergeablestore/">MergeableStore</a></span></code></td><td><p>The <a href="#/api/the-essentials/creating-stores/store/"><code>Store</code></a> or <a href="#/api/mergeable-store/interfaces/mergeable/mergeablestore/"><code>MergeableStore</code></a> to persist.</p></td></tr><tr><th><code>storage</code></th><td><code><span class="constant">MMKV</span></code></td><td><p>The MMKV storage instance.</p></td></tr><tr><th><code>storageName<span class="operator">?</span></code></th><td><code><span class="builtin">string</span></code></td><td><p>The unique key to identify the storage location.</p></td></tr><tr><th><code>onIgnoredError<span class="operator">?</span></code></th><td><code><span class="punctuation">(</span>error<span class="operator">:</span> <span class="builtin">any</span><span class="punctuation">)</span> <span class="operator">=></span> <span class="keyword">void</span></code></td><td><p>An optional handler for the errors that the <a href="#/api/the-essentials/persisting-stores/persister/"><code>Persister</code></a> would otherwise ignore when trying to save or load data. This is suitable for debugging persistence issues in a development environment.</p></td></tr><tr><th class="right">returns</th><td><code><span class="type"><a href="#/api/persister-react-native-mmkv/interfaces/persister/reactnativemmkvpersister/">ReactNativeMmkvPersister</a></span></code></td><td><p></p><p>A reference to the new <a href="#/api/persister-react-native-mmkv/interfaces/persister/reactnativemmkvpersister/"><code>ReactNativeMmkvPersister</code></a> object.</p><p></p></td></tr></table></div><p>A <a href="#/api/persister-react-native-mmkv/interfaces/persister/reactnativemmkvpersister/"><code>ReactNativeMmkvPersister</code></a> supports both regular <a href="#/api/the-essentials/creating-stores/store/"><code>Store</code></a> and <a href="#/api/mergeable-store/interfaces/mergeable/mergeablestore/"><code>MergeableStore</code></a> objects.</p><p>As well as providing a reference to the <a href="#/api/the-essentials/creating-stores/store/"><code>Store</code></a> to persist, you must provide a <code>storage</code> parameter which identifies the MMKV storage instance.</p><p>The third argument is a <code>storageName</code> string that configures which key to use for the storage key.</p><section class="s5"><h5>Example</h5><p>This example creates a <a href="#/api/persister-react-native-mmkv/interfaces/persister/reactnativemmkvpersister/"><code>ReactNativeMmkvPersister</code></a> object and persists the <a href="#/api/the-essentials/creating-stores/store/"><code>Store</code></a> to a MMKV storage instance as a JSON serialization into the <code>my_tinybase</code> key. It makes a change to the storage directly and then reloads it back into the <a href="#/api/the-essentials/creating-stores/store/"><code>Store</code></a>.</p><pre><code><span class="keyword">import</span> <span class="punctuation">{</span>createMMKV<span class="punctuation">}</span> <span class="keyword">from</span> <span class="string">'react-native-mmkv'</span><span class="punctuation">;</span>
0 commit comments