Skip to content

Commit 40aaefd

Browse files
committed
Merge pull request #2960 from Microsoft/DataViewDefinition
Fix #2953: Put DataView definition back into lib.d.ts
2 parents 377b48f + 31fe7c4 commit 40aaefd

File tree

1 file changed

+133
-0
lines changed

1 file changed

+133
-0
lines changed

src/lib/extensions.d.ts

+133
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,139 @@ interface ArrayBufferView {
4545
byteOffset: number;
4646
}
4747

48+
interface DataView {
49+
buffer: ArrayBuffer;
50+
byteLength: number;
51+
byteOffset: number;
52+
/**
53+
* Gets the Float32 value at the specified byte offset from the start of the view. There is
54+
* no alignment constraint; multi-byte values may be fetched from any offset.
55+
* @param byteOffset The place in the buffer at which the value should be retrieved.
56+
*/
57+
getFloat32(byteOffset: number, littleEndian: boolean): number;
58+
59+
/**
60+
* Gets the Float64 value at the specified byte offset from the start of the view. There is
61+
* no alignment constraint; multi-byte values may be fetched from any offset.
62+
* @param byteOffset The place in the buffer at which the value should be retrieved.
63+
*/
64+
getFloat64(byteOffset: number, littleEndian: boolean): number;
65+
66+
/**
67+
* Gets the Int8 value at the specified byte offset from the start of the view. There is
68+
* no alignment constraint; multi-byte values may be fetched from any offset.
69+
* @param byteOffset The place in the buffer at which the value should be retrieved.
70+
*/
71+
getInt8(byteOffset: number): number;
72+
73+
/**
74+
* Gets the Int16 value at the specified byte offset from the start of the view. There is
75+
* no alignment constraint; multi-byte values may be fetched from any offset.
76+
* @param byteOffset The place in the buffer at which the value should be retrieved.
77+
*/
78+
getInt16(byteOffset: number, littleEndian: boolean): number;
79+
/**
80+
* Gets the Int32 value at the specified byte offset from the start of the view. There is
81+
* no alignment constraint; multi-byte values may be fetched from any offset.
82+
* @param byteOffset The place in the buffer at which the value should be retrieved.
83+
*/
84+
getInt32(byteOffset: number, littleEndian: boolean): number;
85+
86+
/**
87+
* Gets the Uint8 value at the specified byte offset from the start of the view. There is
88+
* no alignment constraint; multi-byte values may be fetched from any offset.
89+
* @param byteOffset The place in the buffer at which the value should be retrieved.
90+
*/
91+
getUint8(byteOffset: number): number;
92+
93+
/**
94+
* Gets the Uint16 value at the specified byte offset from the start of the view. There is
95+
* no alignment constraint; multi-byte values may be fetched from any offset.
96+
* @param byteOffset The place in the buffer at which the value should be retrieved.
97+
*/
98+
getUint16(byteOffset: number, littleEndian: boolean): number;
99+
100+
/**
101+
* Gets the Uint32 value at the specified byte offset from the start of the view. There is
102+
* no alignment constraint; multi-byte values may be fetched from any offset.
103+
* @param byteOffset The place in the buffer at which the value should be retrieved.
104+
*/
105+
getUint32(byteOffset: number, littleEndian: boolean): number;
106+
107+
/**
108+
* Stores an Float32 value at the specified byte offset from the start of the view.
109+
* @param byteOffset The place in the buffer at which the value should be set.
110+
* @param value The value to set.
111+
* @param littleEndian If false or undefined, a big-endian value should be written,
112+
* otherwise a little-endian value should be written.
113+
*/
114+
setFloat32(byteOffset: number, value: number, littleEndian: boolean): void;
115+
116+
/**
117+
* Stores an Float64 value at the specified byte offset from the start of the view.
118+
* @param byteOffset The place in the buffer at which the value should be set.
119+
* @param value The value to set.
120+
* @param littleEndian If false or undefined, a big-endian value should be written,
121+
* otherwise a little-endian value should be written.
122+
*/
123+
setFloat64(byteOffset: number, value: number, littleEndian: boolean): void;
124+
125+
/**
126+
* Stores an Int8 value at the specified byte offset from the start of the view.
127+
* @param byteOffset The place in the buffer at which the value should be set.
128+
* @param value The value to set.
129+
*/
130+
setInt8(byteOffset: number, value: number): void;
131+
132+
/**
133+
* Stores an Int16 value at the specified byte offset from the start of the view.
134+
* @param byteOffset The place in the buffer at which the value should be set.
135+
* @param value The value to set.
136+
* @param littleEndian If false or undefined, a big-endian value should be written,
137+
* otherwise a little-endian value should be written.
138+
*/
139+
setInt16(byteOffset: number, value: number, littleEndian: boolean): void;
140+
141+
/**
142+
* Stores an Int32 value at the specified byte offset from the start of the view.
143+
* @param byteOffset The place in the buffer at which the value should be set.
144+
* @param value The value to set.
145+
* @param littleEndian If false or undefined, a big-endian value should be written,
146+
* otherwise a little-endian value should be written.
147+
*/
148+
setInt32(byteOffset: number, value: number, littleEndian: boolean): void;
149+
150+
/**
151+
* Stores an Uint8 value at the specified byte offset from the start of the view.
152+
* @param byteOffset The place in the buffer at which the value should be set.
153+
* @param value The value to set.
154+
*/
155+
setUint8(byteOffset: number, value: number): void;
156+
157+
/**
158+
* Stores an Uint16 value at the specified byte offset from the start of the view.
159+
* @param byteOffset The place in the buffer at which the value should be set.
160+
* @param value The value to set.
161+
* @param littleEndian If false or undefined, a big-endian value should be written,
162+
* otherwise a little-endian value should be written.
163+
*/
164+
setUint16(byteOffset: number, value: number, littleEndian: boolean): void;
165+
166+
/**
167+
* Stores an Uint32 value at the specified byte offset from the start of the view.
168+
* @param byteOffset The place in the buffer at which the value should be set.
169+
* @param value The value to set.
170+
* @param littleEndian If false or undefined, a big-endian value should be written,
171+
* otherwise a little-endian value should be written.
172+
*/
173+
setUint32(byteOffset: number, value: number, littleEndian: boolean): void;
174+
}
175+
176+
interface DataViewConstructor {
177+
new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView;
178+
}
179+
declare var DataView: DataViewConstructor;
180+
48181
/**
49182
* A typed array of 8-bit integer values. The contents are initialized to 0. If the requested
50183
* number of bytes could not be allocated an exception is raised.

0 commit comments

Comments
 (0)