blob: d418df13669cf47ddeb1fd30b45da7e1a743360d (
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
77
78
79
80
|
---
title: DataView.prototype.getBigUint64()
slug: Web/JavaScript/Reference/Global_Objects/DataView/getBigUint64
translation_of: Web/JavaScript/Reference/Global_Objects/DataView/getBigUint64
---
<div>{{JSRef}}</div>
<p><strong><code>getBigUint64()</code></strong>方法,从{{jsxref("DataView")}}的指定偏移量位置获取一个无符号64位整数(unsigned long long)。</p>
<div>{{EmbedInteractiveExample("pages/js/dataview-getbiguint64.html")}}</div>
<p class="hidden">上述交互例程存储在github仓库中. 如果你想贡献这段交互代码, 请克隆<a href="https://github.com/mdn/interactive-examples">https://github.com/mdn/interactive-examples</a> ,然后给我们提交一个pull request.</p>
<h2 id="语法">语法</h2>
<pre class="syntaxbox"><var>dataview</var>.getBigUint64(byteOffset [, littleEndian])</pre>
<h3 id="参数">参数</h3>
<dl>
<dt>byteOffset</dt>
<dd>偏移量,按<strong>字节</strong>偏移,从DataView读取一个整数</dd>
<dt>littleEndian</dt>
<dd>{{optional_inline}} 指出64位整数以 {{Glossary("Endianness", "little- or big-endian")}} 类型存储. 如果值为 <code>false</code> or <code>undefined</code>, 读取一个大端数值.</dd>
</dl>
<h3 id="返回值">返回值</h3>
<p>A {{jsxref("BigInt")}}.</p>
<h3 id="异常">异常</h3>
<dl>
<dt>{{jsxref("RangeError")}}</dt>
<dd>Thrown if the <code>byteOffset</code> is set such that it would read beyond the end of the view.</dd>
</dl>
<h2 id="Description">Description</h2>
<p>There is no alignment constraint; multi-byte values may be fetched from any offset.</p>
<h2 id="Examples">Examples</h2>
<h3 id="Using_the_getBigUint64_method">Using the <code>getBigUint64</code> method</h3>
<pre class="brush:js">var buffer = new ArrayBuffer(8);
var dataview = new DataView(buffer);
dataview.getBigUint64(0); // 0n
</pre>
<h2 id="Specifications">Specifications</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">Specification</th>
<th scope="col">Status</th>
<th scope="col">Comment</th>
</tr>
<tr>
<td><a href="https://tc39.es/proposal-bigint/#sec-dataview.prototype.getbiguint64">DataView.prototype.getBigUint64 proposal</a></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<p>{{Compat("javascript.builtins.DataView.getBigUint64")}}</p>
<h2 id="See_also">See also</h2>
<ul>
<li>{{jsxref("DataView")}}</li>
<li>{{jsxref("ArrayBuffer")}}</li>
<li>{{jsxref("BigInt")}}</li>
</ul>
|