aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/url/revokeobjecturl/index.html
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/url/revokeobjecturl/index.html
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/api/url/revokeobjecturl/index.html')
-rw-r--r--files/zh-cn/web/api/url/revokeobjecturl/index.html68
1 files changed, 68 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/url/revokeobjecturl/index.html b/files/zh-cn/web/api/url/revokeobjecturl/index.html
new file mode 100644
index 0000000000..4619beb7e1
--- /dev/null
+++ b/files/zh-cn/web/api/url/revokeobjecturl/index.html
@@ -0,0 +1,68 @@
+---
+title: URL.revokeObjectURL()
+slug: Web/API/URL/revokeObjectURL
+tags:
+ - API
+ - URL
+ - URL API
+ - 方法
+translation_of: Web/API/URL/revokeObjectURL
+---
+<div>{{ApiRef("URL")}}</div>
+
+<p><strong><code>URL.revokeObjectURL()</code> </strong> 静态方法用来释放一个之前已经存在的、通过调用 {{domxref("URL.createObjectURL()")}} 创建的 URL 对象。当你结束使用某个 URL 对象之后,应该通过调用这个方法来让浏览器知道不用在内存中继续保留对这个文件的引用了。</p>
+
+<p>你可以在 <code>sourceopen</code> 被处理之后的任何时候调用 <code>revokeObjectURL()</code>。这是因为 <code>createObjectURL()</code> 仅仅意味着将一个媒体元素的 <code>src</code> 属性关联到一个 {{domxref("MediaSource")}} 对象上去。调用<code>revokeObjectURL()</code> 使这个潜在的对象回到原来的地方,允许平台在合适的时机进行垃圾收集。</p>
+
+<p>{{AvailableInWorkers}}</p>
+
+<h2 id="语法">语法</h2>
+
+<pre class="syntaxbox">window.URL.revokeObjectURL(object<em>URL</em>);
+</pre>
+
+<h3 id="参数">参数</h3>
+
+<dl>
+ <dt><code>objectURL</code></dt>
+ <dd>一个 {{domxref("DOMString")}},表示通过调用 {{domxref("URL.createObjectURL()") }} 方法产生的 URL 对象。</dd>
+</dl>
+
+<h3 id="Return_value">Return value</h3>
+
+<p>undefined</p>
+
+<h2 id="示例">示例</h2>
+
+<p>查看<a href="/zh-CN/docs/Using_files_from_web_applications#Example.3a_Using_object_URLs_to_display_images">使用对象 URL 显示图片</a>。</p>
+
+<h2 id="规范">规范</h2>
+
+<table>
+ <tbody>
+ <tr>
+ <th scope="col">规范</th>
+ <th scope="col">状态</th>
+ <th scope="col">备注</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('File API', '#dfn-revokeObjectURL', 'revokeObjectURL()')}}</td>
+ <td>{{Spec2('File API')}}</td>
+ <td>Initial definition</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+
+
+<p>{{Compat("api.URL.revokeObjectURL")}}</p>
+
+<h2 id="参见">参见</h2>
+
+<ul>
+ <li><a href="/zh-CN/docs/Using_files_from_web_applications">在 Web 应用程序中使用文件</a></li>
+ <li><a href="/zh-CN/docs/Using_files_from_web_applications#Example_Using_object_URLs_to_display_images">使用对象 URL 显示图像</a></li>
+ <li>{{domxref("URL.createObjectURL()") }}</li>
+</ul>