diff options
Diffstat (limited to 'files/ja/web/api/writablestream/abort/index.html')
-rw-r--r-- | files/ja/web/api/writablestream/abort/index.html | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/files/ja/web/api/writablestream/abort/index.html b/files/ja/web/api/writablestream/abort/index.html new file mode 100644 index 0000000000..9b8a2ba900 --- /dev/null +++ b/files/ja/web/api/writablestream/abort/index.html @@ -0,0 +1,84 @@ +--- +title: WritableStream.abort() +slug: Web/API/WritableStream/abort +tags: + - API + - Experimental + - Method + - Reference + - Streams + - WritableStream + - abort +translation_of: Web/API/WritableStream/abort +--- +<div>{{draft}}{{SeeCompatTable}}{{APIRef("Streams")}}</div> + +<p class="summary"><span class="seoSummary">{{domxref("WritableStream")}} インターフェイスの <strong><code>abort()</code></strong> メソッドはストリームを中止し、プロデューサーがストリームに正常に書き込むことができなくなり、キューに入れられた書き込みが破棄されてすぐにエラー状態に移行することを通知します。</span></p> + +<h2 id="Syntax" name="Syntax">構文</h2> + +<pre class="syntaxbox">var <em>promise</em> = <em>writableStream</em>.abort(<em>reason</em>);</pre> + +<h3 id="Parameters" name="Parameters">パラメーター</h3> + +<dl> + <dt>reason</dt> + <dd>人間が読むことができる中止の理由を提供する {{domxref("DOMString")}}。</dd> +</dl> + +<h3 id="Return_value" name="Return_value">戻り値</h3> + +<p>{{jsxref("Promise")}}。 <code>reason</code> パラメーターで指定された値で満たされます。</p> + +<h3 id="Exceptions" name="Exceptions">例外</h3> + +<dl> + <dt>TypeError</dt> + <dd>中止しようとしているストリームは {{domxref("WritableStream")}} ではないか、ロックされています。</dd> +</dl> + +<h2 id="Examples" name="Examples">例</h2> + +<pre class="brush: js line-numbers language-js"><code class="language-js"><span class="keyword token">const</span> writableStream <span class="operator token">=</span> <span class="keyword token">new</span> <span class="class-name token">WritableStream</span><span class="punctuation token">(</span><span class="punctuation token">{</span> + <span class="function token">write</span><span class="punctuation token">(</span>chunk<span class="punctuation token">)</span> <span class="punctuation token">{</span> + ... + <span class="punctuation token">}</span><span class="punctuation token">,</span> + <span class="function token">close</span><span class="punctuation token">(</span><span class="punctuation token">)</span> <span class="punctuation token">{</span> + <span class="keyword token">...</span> + <span class="punctuation token">}</span><span class="punctuation token">,</span> + <span class="function token">abort</span><span class="punctuation token">(</span>err<span class="punctuation token">)</span> <span class="punctuation token">{</span> + ... + <span class="punctuation token">}</span> +<span class="punctuation token">}</span><span class="punctuation token">,</span> queuingStrategy<span class="punctuation token">)</span><span class="punctuation token">;</span> + +... + +// 必要に応じて、後でストリームを中止します +writableStream.abort(); +</code> +</pre> + +<h2 id="Specifications" name="Specifications">仕様</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">仕様</th> + <th scope="col">状態</th> + <th scope="col">コメント</th> + </tr> + <tr> + <td>{{SpecName("Streams","#ws-abort","abort()")}}</td> + <td>{{Spec2('Streams')}}</td> + <td>初期定義</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2> + +<div class="hidden"> +<p>The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p> +</div> + +<p>{{Compat("api.WritableStream.abort")}}</p> |