import{_ as s,o as a,c as n,a as l}from"./app.f643a53b.js";const o={},e=l(`<div class="custom-container warning"><p class="custom-container-title">Notice</p><p>The English translation of this page has not been completed, you are welcome to contribute translations to us.</p><p>You can use the <strong>Chrome Translation Plugin</strong> to translate entire pages for reference.</p></div><h1 id="prefsdata-class" tabindex="-1"><a class="header-anchor" href="#prefsdata-class" aria-hidden="true">#</a> PrefsData <span class="symbol">- class</span></h1><div class="language-kotlin ext-kt"><pre class="shiki" style="background-color:#22272e;"><code><span class="line"><span style="color:#F47067;">data</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">class</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">PrefsData</span><span style="color:#F47067;">&lt;</span><span style="color:#F69D50;">T</span><span style="color:#F47067;">&gt;</span><span style="color:#ADBAC7;">(</span><span style="color:#F47067;">var</span><span style="color:#ADBAC7;"> key</span><span style="color:#F47067;">:</span><span style="color:#ADBAC7;"> </span><span style="color:#6CB6FF;">String</span><span style="color:#ADBAC7;">, </span><span style="color:#F47067;">var</span><span style="color:#ADBAC7;"> value</span><span style="color:#F47067;">:</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">T</span><span style="color:#ADBAC7;">) </span><span style="color:#F47067;">:</span><span style="color:#ADBAC7;"> </span><span style="color:#6CB6FF;">Serializable</span></span>
<span class="line"></span></code></pre></div><p><strong>Change Records</strong></p><p><code>v1.0.67</code> <code>added</code></p><p><code>v1.1.5</code> <code>modified</code></p><p>\u5B9E\u73B0\u4E86 <code>Serializable</code> \u63A5\u53E3</p><p><strong>Function Illustrate</strong></p><blockquote><p>\u952E\u503C\u5BF9\u5B58\u50A8\u6784\u9020\u7C7B\u3002</p></blockquote><p>\u8FD9\u4E2A\u7C7B\u662F\u5BF9 <code>YukiHookPrefsBridge</code> \u7684\u4E00\u4E2A\u6269\u5C55\u7528\u6CD5\u3002</p><p><strong>Function Example</strong></p><p>\u5EFA\u7ACB\u4E00\u4E2A\u6A21\u677F\u7C7B\u5B9A\u4E49\u6A21\u5757\u4E0E\u5BBF\u4E3B\u9700\u8981\u4F7F\u7528\u7684\u952E\u503C\u6570\u636E\u3002</p><blockquote><p>The following example</p></blockquote><div class="language-kotlin ext-kt line-numbers-mode"><pre class="shiki" style="background-color:#22272e;"><code><span class="line"><span style="color:#F47067;">object</span><span style="color:#ADBAC7;"> DataConst {</span></span>
<span class="line"></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">TEST_KV_DATA_1</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">PrefsData</span><span style="color:#ADBAC7;">(</span><span style="color:#96D0FF;">&quot;test_data_1&quot;</span><span style="color:#ADBAC7;">, </span><span style="color:#96D0FF;">&quot;defalut value&quot;</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">TEST_KV_DATA_2</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">PrefsData</span><span style="color:#ADBAC7;">(</span><span style="color:#96D0FF;">&quot;test_data_2&quot;</span><span style="color:#ADBAC7;">, </span><span style="color:#6CB6FF;">false</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">TEST_KV_DATA_3</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">PrefsData</span><span style="color:#ADBAC7;">(</span><span style="color:#96D0FF;">&quot;test_data_3&quot;</span><span style="color:#ADBAC7;">, </span><span style="color:#6CB6FF;">0</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#ADBAC7;">}</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>\u952E\u503C\u6570\u636E\u5B9A\u4E49\u540E\uFF0C\u4F60\u5C31\u53EF\u4EE5\u65B9\u4FBF\u5730\u5728\u6A21\u5757\u548C\u5BBF\u4E3B\u4E2D\u8C03\u7528\u6240\u9700\u8981\u7684\u6570\u636E\u3002</p><blockquote><p>\u6A21\u5757\u793A\u4F8B\u5982\u4E0B</p></blockquote><div class="language-kotlin ext-kt line-numbers-mode"><pre class="shiki" style="background-color:#22272e;"><code><span class="line"><span style="color:#768390;">// \u8BFB\u53D6</span></span>
<span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">data</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> prefs().get(</span><span style="color:#F69D50;">DataConst</span><span style="color:#ADBAC7;">.</span><span style="color:#F69D50;">TEST_KV_DATA_1</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#768390;">// \u5199\u5165</span></span>
<span class="line"><span style="color:#ADBAC7;">prefs().edit { put(</span><span style="color:#F69D50;">DataConst</span><span style="color:#ADBAC7;">.</span><span style="color:#F69D50;">TEST_KV_DATA_1</span><span style="color:#ADBAC7;">, </span><span style="color:#96D0FF;">&quot;written value&quot;</span><span style="color:#ADBAC7;">) }</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><blockquote><p>\u5BBF\u4E3B\u793A\u4F8B\u5982\u4E0B</p></blockquote><div class="language-kotlin ext-kt line-numbers-mode"><pre class="shiki" style="background-color:#22272e;"><code><span class="line"><span style="color:#768390;">// \u8BFB\u53D6 String</span></span>
<span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> dataString </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> prefs.get(</span><span style="color:#F69D50;">DataConst</span><span style="color:#ADBAC7;">.</span><span style="color:#F69D50;">TEST_KV_DATA_1</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#768390;">// \u8BFB\u53D6 Boolean</span></span>
<span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> dataBoolean </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> prefs.get(</span><span style="color:#F69D50;">DataConst</span><span style="color:#ADBAC7;">.</span><span style="color:#F69D50;">TEST_KV_DATA_2</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>\u4F60\u4F9D\u7136\u53EF\u4EE5\u4E0D\u4F7F\u7528\u6A21\u677F\u5B9A\u4E49\u7684\u9ED8\u8BA4\u503C\uFF0C\u968F\u65F6\u4FEE\u6539\u4F60\u7684\u9ED8\u8BA4\u503C\u3002</p><blockquote><p>The following example</p></blockquote><div class="language-kotlin ext-kt line-numbers-mode"><pre class="shiki" style="background-color:#22272e;"><code><span class="line"><span style="color:#768390;">// \u8BFB\u53D6 - \u6B64\u65F6 data \u53D6\u5230\u7684\u9ED8\u8BA4\u503C\u5C06\u4F1A\u662F 2 - \u5E76\u4E0D\u662F\u6A21\u677F\u63D0\u4F9B\u7684 0</span></span>
<span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">data</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> prefs.get(</span><span style="color:#F69D50;">DataConst</span><span style="color:#ADBAC7;">.</span><span style="color:#F69D50;">TEST_KV_DATA_3</span><span style="color:#ADBAC7;">, </span><span style="color:#6CB6FF;">2</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div></div></div>`,22),p=[e];function t(c,r){return a(),n("div",null,p)}const A=s(o,[["render",t],["__file","PrefsData.html.vue"]]);export{A as default};
