Uint8ClampedArray

js.lib.Uint8ClampedArray (extern class)
Implements: ArrayBufferView

The Uint8ClampedArray typed array represents an array of 8-bit unsigned integers clamped to 0-255; if you specified a value that is out of the range of [0,255], 0 or 255 will be set instead; if you specify a non-integer, the nearest integer will be set. The contents are initialized to 0. Once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation).

Documentation Uint8ClampedArray by Mozilla Contributors, licensed under CC-BY-SA 2.5.

Static Members

BYTES_PER_ELEMENT: Int

Returns a number value of the element size. 1 in the case of an Uint8ClampedArray.


Creates a new Uint8ClampedArray with a variable number of arguments. See also Array.of().

Name Type
elements haxe.extern.Rest
Returns
Uint8ClampedArray

Instance Members

BYTES_PER_ELEMENT_: Int

Returns a number value of the element size.


buffer: ArrayBuffer

Returns the ArrayBuffer referenced by the Uint8ClampedArray Fixed at construction time and thus read only.


byteLength: Int

Returns the length (in bytes) of the Uint8ClampedArray from the start of its ArrayBuffer. Fixed at construction time and thus read only.


byteOffset: Int

Returns the offset (in bytes) of the Uint8ClampedArray from the start of its ArrayBuffer. Fixed at construction time and thus read only.


length: Int

Returns the number of elements hold in the Uint8ClampedArray. Fixed at construction time and thus read only.


copyWithin(target: Int, start: Int, ?end: Int): Uint8ClampedArray

Copies a sequence of array elements within the array. See also Array.prototype.copyWithin().

Name Type Default
target Int
start Int
end Int (optional)
Returns
Uint8ClampedArray

entries(): Iterator

Returns a new Array Iterator object that contains the key/value pairs for each index in the array. See also Array.prototype.entries().

Returns
Iterator

every(callback: Function, ?thisArg: Any): Bool

Tests whether all elements in the array pass the test provided by a function. See also Array.prototype.every().

Name Type Default
callback Function
thisArg Any (optional)
Returns
Bool

fill(value: Int, ?start: Int, ?end: Int): Uint8ClampedArray

Fills all the elements of an array from a start index to an end index with a static value. See also Array.prototype.fill().

Name Type Default
value Int
start Int (optional)
end Int (optional)
Returns
Uint8ClampedArray

filter(callback: Function, ?thisArg: Any): Uint8ClampedArray

Creates a new array with all of the elements of this array for which the provided filtering function returns true. See also Array.prototype.filter().

Name Type Default
callback Function
thisArg Any (optional)
Returns
Uint8ClampedArray

find(callback: Function, ?thisArg: Any): Null<Int>

Returns the found value in the array, if an element in the array satisfies the provided testing function or undefined if not found. See also Array.prototype.find().

Name Type Default
callback Function
thisArg Any (optional)
Returns
Null<Int>

findIndex(callback: Function, ?thisArg: Any): Int

Returns the found index in the array, if an element in the array satisfies the provided testing function or -1 if not found. See also Array.prototype.findIndex().

Name Type Default
callback Function
thisArg Any (optional)
Returns
Int

forEach(callback: Function, ?thisArg: Any): Void

Calls a function for each element in the array. See also Array.prototype.forEach().

Name Type Default
callback Function
thisArg Any (optional)

includes(searchElement: Int, ?fromIndex: Int): Bool

Determines whether a typed array includes a certain element, returning true or false as appropriate. See also Array.prototype.includes().

Name Type Default
searchElement Int
fromIndex Int (optional)
Returns
Bool

indexOf(searchElement: Int, ?fromIndex: Int): Int

Returns the first (least) index of an element within the array equal to the specified value, or -1 if none is found. See also Array.prototype.indexOf().

Name Type Default
searchElement Int
fromIndex Int (optional)
Returns
Int

join(?separator: String): String

Joins all elements of an array into a string. See also Array.prototype.join().

Name Type Default
separator String (optional)
Returns
String

keys(): Iterator

Returns a new Array Iterator that contains the keys for each index in the array. See also Array.prototype.keys().

Returns
Iterator

lastIndexOf(searchElement: Int, ?fromIndex: Int): Int

Returns the last (greatest) index of an element within the array equal to the specified value, or -1 if none is found. See also Array.prototype.lastIndexOf().

Name Type Default
searchElement Int
fromIndex Int (optional)
Returns
Int

map(callback: Function, ?thisArg: Any): Uint8ClampedArray

Creates a new array with the results of calling a provided function on every element in this array. See also Array.prototype.map().

Name Type Default
callback Function
thisArg Any (optional)
Returns
Uint8ClampedArray

reduce(callback: Function, initialValue: reduce.T): reduce.T

Apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value. See also Array.prototype.reduce().

Name Type
callback Function
initialValue reduce.T
Returns
reduce.T

reduceRight(callback: Function, initialValue: reduceRight.T): reduceRight.T

Apply a function against an accumulator and each value of the array (from right-to-left) as to reduce it to a single value. See also Array.prototype.reduceRight().

Name Type
callback Function
initialValue reduceRight.T
Returns
reduceRight.T

Reverses the order of the elements of an array — the first becomes the last, and the last becomes the first. See also Array.prototype.reverse().

Returns
Uint8ClampedArray

set(array: Array<Int>, ?offset: Int): Void

Stores multiple values in the typed array, reading input values from a specified array.

Name Type Default
array Array<Int>
offset Int (optional)

slice(?start: Int, ?end: Int): Uint8ClampedArray

Extracts a section of an array and returns a new array. See also Array.prototype.slice().

Name Type Default
start Int (optional)
end Int (optional)
Returns
Uint8ClampedArray

some(callback: Function, ?thisArg: Any): Bool

Returns true if at least one element in this array satisfies the provided testing function. See also Array.prototype.some().

Name Type Default
callback Function
thisArg Any (optional)
Returns
Bool

sort(?compareFn: Function): Uint8ClampedArray

Sorts the elements of an array in place and returns the array. See also Array.prototype.sort().

Name Type Default
compareFn Function (optional)
Returns
Uint8ClampedArray

subarray(?begin: Int, ?end: Int): Uint8ClampedArray

Returns a new TypedArray from the given start and end element index.

Name Type Default
begin Int (optional)
end Int (optional)
Returns
Uint8ClampedArray

values(): Iterator

Returns a new Array Iterator object that contains the values for each index in the array. See also Array.prototype.values().

Returns
Iterator

toLocaleString(?locales: String, ?options: Null<js.lib.intl.NumberFormatOptions>): String

Returns a string representing the array and its elements. See also Array.prototype.toString().

Name Type Default
locales String (optional)
options Null<js.lib.intl.NumberFormatOptions> (optional)
Returns
String

toString(): String

Returns a string representing the array and its elements. See also Array.prototype.toString().

Returns
String

new(buffer: ArrayBuffer, ?byteOffset: Int, ?length: Int): Void
Name Type Default
buffer ArrayBuffer
byteOffset Int (optional)
length Int (optional)