blob: f6a00bd7d088d0f418a78414c74c3476efcdd11d [file] [log] [blame]
/*
* Copyright 2015 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// https://www.khronos.org/registry/typedarray/specs/latest/#7.1
[
Constructor(unsigned long length),
Constructor(Uint8Array array),
Constructor(ArrayBuffer buffer, optional unsigned long byteOffset, optional unsigned long length),
ConstructorCallWith=EnvironmentSettings,
RaisesException=Constructor
]
interface Uint8Array : ArrayBufferView {
const unsigned long BYTES_PER_ELEMENT = 1;
readonly attribute unsigned long length;
getter octet get(unsigned long index);
setter void set(unsigned long index, octet value);
// TODO: When arrays or sequences are supported, support them here.
// void set(sequence<long> array, optional unsigned long offset);
// Copy items into this array from source, starting at this[offset].
[RaisesException] void set(Uint8Array source, optional unsigned long offset);
// Return a new Uint8Array that is a view on top of this one.
// Contains this[start]..this[end]. end defaults to length if unspecified.
[CallWith=EnvironmentSettings] Uint8Array subarray(long start, optional long end);
};