mirror of
https://github.com/yume-chan/ya-webadb.git
synced 2025-10-04 18:29:23 +02:00
feat(struct): add Uint8ClampedArray type
This commit is contained in:
parent
c37e3dd953
commit
b601f7a7f2
4 changed files with 21 additions and 6 deletions
|
@ -1,5 +1,5 @@
|
|||
import { createRuntimeObject, FieldDefinition, FieldRuntimeValue, getRuntimeValue, setRuntimeValue, StructDefaultOptions, StructDeserializationContext, StructOptions, StructSerializationContext } from './basic';
|
||||
import { ArrayBufferFieldType, ArrayBufferLikeFieldType, Evaluate, FixedLengthArrayBufferLikeFieldDefinition, FixedLengthArrayBufferLikeFieldOptions, Identity, KeysOfType, NumberFieldDefinition, NumberFieldType, Overwrite, StringFieldType, VariableLengthArrayBufferLikeFieldDefinition, VariableLengthArrayBufferLikeFieldOptions } from './types';
|
||||
import { ArrayBufferFieldType, ArrayBufferLikeFieldType, Evaluate, FixedLengthArrayBufferLikeFieldDefinition, FixedLengthArrayBufferLikeFieldOptions, Identity, KeysOfType, NumberFieldDefinition, NumberFieldType, Overwrite, StringFieldType, Uint8ClampedArrayFieldType, VariableLengthArrayBufferLikeFieldDefinition, VariableLengthArrayBufferLikeFieldOptions } from './types';
|
||||
|
||||
/**
|
||||
* Extract the value type of the specified `Struct`
|
||||
|
@ -354,6 +354,19 @@ export default class Struct<
|
|||
return this.arrayBufferLike(name, ArrayBufferFieldType.instance, options);
|
||||
};
|
||||
|
||||
public uint8ClampedArray: ArrayBufferTypeFieldDefinitionCreator<
|
||||
TValue,
|
||||
TInit,
|
||||
TExtra,
|
||||
TPostDeserialized,
|
||||
Uint8ClampedArrayFieldType
|
||||
> = (
|
||||
name: PropertyKey,
|
||||
options: any
|
||||
): any => {
|
||||
return this.arrayBufferLike(name, Uint8ClampedArrayFieldType.instance, options);
|
||||
};
|
||||
|
||||
public string: ArrayBufferTypeFieldDefinitionCreator<
|
||||
TValue,
|
||||
TInit,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue