aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/idbdatabase/onversionchange/index.html
diff options
context:
space:
mode:
authorMDN <actions@users.noreply.github.com>2022-02-17 00:50:41 +0000
committerMDN <actions@users.noreply.github.com>2022-02-17 00:50:41 +0000
commitca4e750a3400bfd4208831391f115d2f76da23ff (patch)
treed62c647c9a49175619cf7c619915e02360088c96 /files/zh-cn/web/api/idbdatabase/onversionchange/index.html
parentc4f16c96e4b566dda3d48b91ebbb85de5c0a2ec3 (diff)
downloadtranslated-content-ca4e750a3400bfd4208831391f115d2f76da23ff.tar.gz
translated-content-ca4e750a3400bfd4208831391f115d2f76da23ff.tar.bz2
translated-content-ca4e750a3400bfd4208831391f115d2f76da23ff.zip
[CRON] sync translated content
Diffstat (limited to 'files/zh-cn/web/api/idbdatabase/onversionchange/index.html')
-rw-r--r--files/zh-cn/web/api/idbdatabase/onversionchange/index.html97
1 files changed, 0 insertions, 97 deletions
diff --git a/files/zh-cn/web/api/idbdatabase/onversionchange/index.html b/files/zh-cn/web/api/idbdatabase/onversionchange/index.html
deleted file mode 100644
index 3dc9534dea..0000000000
--- a/files/zh-cn/web/api/idbdatabase/onversionchange/index.html
+++ /dev/null
@@ -1,97 +0,0 @@
----
-title: IDBDatabase.onversionchange
-slug: Web/API/IDBDatabase/onversionchange
-translation_of: Web/API/IDBDatabase/onversionchange
----
-<p>{{ APIRef("IndexedDB") }}</p>
-
-<p> {{domxref("IDBDatabase")}} 中的 <strong><code>onversionchange</code></strong> 事件处理器能处理版本更新事件,此事件能在任意地方 (很可能在同一台计算机上的另一个窗口/选项卡中)导致数据库结构更改({{ domxref("IDBOpenDBRequest.onupgradeneeded")}} 事件 或 {{ domxref("IDBFactory.deleteDatabase")}} 事件)的时候被触发 。</p>
-
-<div>
-<p><strong><code>onversionchange</code></strong> 与 <code>versionchange</code> 是不相同的事件(但两者是有关联的)。</p>
-
-<p>{{AvailableInWorkers}}</p>
-</div>
-
-<h2 id="语法">语法</h2>
-
-<pre class="syntaxbox" style="font-size: 14px;"><em>IDBDatabase</em>.onversionchange = <em>function</em>(event) { ... }</pre>
-
-<h2 id="举例">举例</h2>
-
-<p>本例展示了一个创建新对象仓库的 {{domxref("IDBOpenDBRequest.onupgradeneeded")}} 代码块;代码中包含用于处理失败操作的 <code style="font-style: normal;">onerror</code> 和 <code style="font-style: normal;">onabort</code> 函数,以及一个 onversionchange 函数用以在数据库结构被改变时通知用户。</p>
-
-<pre class="brush: js;highlight:[28,29,30,31,32]">request.onupgradeneeded = function(event) {
- var db = event.target.result;
-
- db.onerror = function(event) {
- note.innerHTML += '&lt;li&gt;Error opening database.&lt;/li&gt;';
- };
-
- db.onabort = function(event) {
- note.innerHTML += '&lt;li&gt;Database opening aborted!&lt;/li&gt;';
- };
-
- // 给这个数据库创建对象仓库
-
- var objectStore = db.createObjectStore("toDoList", { keyPath: "taskTitle" });
-
- // 定义对象仓库中包含的数据项
-
- objectStore.createIndex("hours", "hours", { unique: false });
- objectStore.createIndex("minutes", "minutes", { unique: false });
- objectStore.createIndex("day", "day", { unique: false });
- objectStore.createIndex("month", "month", { unique: false });
- objectStore.createIndex("year", "year", { unique: false });
-
- objectStore.createIndex("notified", "notified", { unique: false });
-
- note.innerHTML += '&lt;li&gt;Object store created.&lt;/li&gt;';
-
- db.onversionchange = function(event) {
- note.innerHTML += '&lt;li&gt;a database change has occurred; you should refresh this
- browser window, or close it down and use the other open version of
- this application, wherever it exists.&lt;/li&gt;';
- };
-};</pre>
-
-<h2 id="格式">格式</h2>
-
-<table class="standard-table">
- <tbody>
- <tr>
- <th scope="col">格式</th>
- <th scope="col">状态</th>
- <th scope="col">注释</th>
- </tr>
- <tr>
- <td>{{SpecName('IndexedDB', '#widl-IDBDatabase-onversionchange', 'onversionchange')}}</td>
- <td>{{Spec2('IndexedDB')}}</td>
- <td> </td>
- </tr>
- <tr>
- <td>{{SpecName("IndexedDB 2", "#dom-idbdatabase-onversionchange", "onversionchange")}}</td>
- <td>{{Spec2("IndexedDB 2")}}</td>
- <td> </td>
- </tr>
- </tbody>
-</table>
-
-<h2 id="Browser_compatibility" name="Browser_compatibility">浏览器兼容性</h2>
-
-<div>
-<p>{{Compat("api.IDBDatabase.onversionchange")}}</p>
-</div>
-
-<h2 id="更多参考">更多参考</h2>
-
-<ul>
- <li><a href="/en-US/docs/Web/API/IndexedDB_API/Using_IndexedDB">使用 IndexedDB</a></li>
- <li>开始了解事务: {{domxref("IDBDatabase")}}</li>
- <li>使用事务: {{domxref("IDBTransaction")}}</li>
- <li>设置键值范围: {{domxref("IDBKeyRange")}}</li>
- <li>检索与修改数据: {{domxref("IDBObjectStore")}}</li>
- <li>使用游标: {{domxref("IDBCursor")}}</li>
- <li>参考用例: <a class="external" href="https://github.com/mdn/to-do-notifications/tree/gh-pages">To-do Notifications</a> (<a class="external" href="http://mdn.github.io/to-do-notifications/">view example live</a>.)</li>
- <li><code><a href="/en-US/docs/Web/API/IDBDatabase/versionchange_event">versionchange</a></code> 事件</li>
-</ul>