blob: 3cc4d3c2c5678026556d649cd591b417948669b3 [file] [log] [blame]
/*
* Copyright 2016 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
[
Constructor(unsigned long length),
Constructor(Int16Array array),
Constructor(ArrayBuffer buffer, optional unsigned long byteOffset, optional unsigned long length),
ConstructorCallWith=EnvironmentSettings,
RaisesException=Constructor
]
interface Int16Array : ArrayBufferView {
const unsigned long BYTES_PER_ELEMENT = 2;
readonly attribute unsigned long length;
getter short get(unsigned long index);
setter void set(unsigned long index, short 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(Int16Array source, optional unsigned long offset);
// Return a new Int16Array that is a view on top of this one.
// Contains this[start]..this[end]. end defaults to length if unspecified.
[CallWith=EnvironmentSettings] Int16Array subarray(long start, optional long end);
};