Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "serializer"

Index

Type aliases

Primitive

Primitive: undefined | null | void | boolean | number | string | BigInt

SerializableArray

SerializableArray: SerializableData[]

SerializableData

SerializableData: Primitive | SerializableArray | SerializableObject | Transferable | Error

SerializableObject

SerializableObject: {} | SerializationFuncObject

SerializationFuncObject

SerializationFuncObject: { [toRpcSerialized]: SerializationFunction }

Type declaration

SerializationFunction

SerializationFunction: (data: SerializableData, xfer: Transferable[]) => SerializedData

Type declaration

SerializedArray

SerializedArray: SerializedData[]

SerializedData

SerializedData: Primitive | SerializedArray | SerializedObject | Transferable

SerializedObject

SerializedObject: {}

Type declaration

Variables

Const toRpcSerialized

toRpcSerialized: unique symbol = Symbol('ChannelRpcSerialize')

Const transferrables

transferrables: (false | { constructor: any; prototype: __type } | { constructor: any; prototype: __type } | { constructor: any; prototype: __type } | ArrayBufferConstructor | Int8ArrayConstructor | Int16ArrayConstructor | Int32ArrayConstructor | BigInt64ArrayConstructor | Uint8ArrayConstructor | Uint8ClampedArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor | BigUint64ArrayConstructor | Float32ArrayConstructor | Float64ArrayConstructor)[] = [typeof MessagePort !== 'undefined' && MessagePort,typeof ImageBitmap !== 'undefined' && ImageBitmap,typeof OffscreenCanvas !== 'undefined' && OffscreenCanvas,typeof ArrayBuffer !== 'undefined' && ArrayBuffer,typeof Int8Array !== 'undefined' && Int8Array,typeof Int16Array !== 'undefined' && Int16Array,typeof Int32Array !== 'undefined' && Int32Array,typeof BigInt64Array !== 'undefined' && BigInt64Array,typeof Uint8Array !== 'undefined' && Uint8Array,typeof Uint8ClampedArray !== 'undefined' && Uint8ClampedArray,typeof Uint16Array !== 'undefined' && Uint16Array,typeof Uint32Array !== 'undefined' && Uint32Array,typeof BigUint64Array !== 'undefined' && BigUint64Array,typeof Float32Array !== 'undefined' && Float32Array,typeof Float64Array !== 'undefined' && Float64Array].filter((d) => d)

Javascript will throw errors if I do a simple defined check, so all of this crap is to ensure that doesn't happen. It would be nice to put this in a function, but then JS would throw the error. So, all of this typed out crap is actually necessary.

Functions

rpcSerialize

  • Prepares data to be sent over a MessagePort by ensuring that all data is of a type that can be sent and that all transferrables are pushed to xfer.

    todo

    Make error stack sending configurable

    Parameters

    • data: SerializableData

      Data to serialize

    • xfer: Transferable[]

      Destination array for transferrables

    Returns SerializedData

    The data in serialized format

Generated using TypeDoc