aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/api/bytelengthqueuingstrategy/index.html
blob: 317571bb8b5a88d25b61944c4452b6626954b284 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
---
title: ByteLengthQueuingStrategy
slug: Web/API/ByteLengthQueuingStrategy
tags:
  - API
  - ByteLengthQueuingStrategy
  - Experimental
  - Interface
  - Reference
  - Streams
translation_of: Web/API/ByteLengthQueuingStrategy
---
<p>{{SeeCompatTable}}{{APIRef("Streams")}}</p>

<p><span class="seoSummary"><a href="/ja/docs/Web/API/Streams_API">Streams API</a><strong><code>ByteLengthQueuingStrategy</code></strong> インターフェイスは、ストリームを構築するときに使用できる組み込みのバイト長キューイング戦略を提供します。</span></p>

<h2 id="Constructor" name="Constructor">コンストラクター</h2>

<dl>
 <dt>{{domxref("ByteLengthQueuingStrategy.ByteLengthQueuingStrategy", "ByteLengthQueuingStrategy()")}}</dt>
 <dd>新しい <code>ByteLengthQueuingStrategy</code> オブジェクトのインスタンスを作成します。</dd>
</dl>

<h2 id="Properties" name="Properties">プロパティ</h2>

<p>なし。</p>

<h2 id="Methods" name="Methods">メソッド</h2>

<dl>
 <dt>{{domxref("ByteLengthQueuingStrategy.size()")}}</dt>
 <dd>所与のチャンクの <code>byteLength</code> プロパティを返します。</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> queueingStrategy <span class="operator token">=</span> <span class="keyword token">new</span> ByteLength<span class="class-name token">QueuingStrategy</span><span class="punctuation token">(</span><span class="punctuation token">{</span> highWaterMark<span class="punctuation token">:</span> <span class="number token">1</span> <span class="punctuation token">}</span><span class="punctuation token">)</span><span class="punctuation token">;</span>

<span class="keyword token">const</span> readableStream <span class="operator token">=</span> <span class="keyword token">new</span> Readable<span class="class-name token">Stream</span><span class="punctuation token">(</span><span class="punctuation token">{</span>
  <span class="function token">start</span><span class="punctuation token">(</span>controller<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>
  <span class="punctuation token">}</span><span class="punctuation token">,</span>
  pull<span class="punctuation token">(controller</span><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>
  <span class="punctuation token">}</span><span class="punctuation token">,</span>
  <span class="function token">cancel</span><span class="punctuation token">(</span>err<span class="punctuation token">)</span> <span class="punctuation token">{</span>
    console<span class="punctuation token">.</span><span class="function token">log</span><span class="punctuation token">(</span><span class="string token">"stream error:"</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> queueingStrategy<span class="punctuation token">)</span><span class="punctuation token">;</span>

<span class="keyword token">var</span> size <span class="operator token">=</span> queueingStrategy<span class="punctuation token">.</span><span class="function token">size</span><span class="punctuation token">(</span><span class="punctuation token">chunk)</span></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','#blqs-class','ByteLengthQueuingStrategy')}}</td>
   <td>{{Spec2('Streams')}}</td>
   <td>初期定義</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_Compatibility" name="Browser_Compatibility">ブラウザーの互換性</h2>

<div>


<p>{{Compat("api.ByteLengthQueuingStrategy")}}</p>
</div>