UNPKG

@aire-ux/aire-condensation

Version:

Client-side serialization library for Aire-UX

52 lines (51 loc) 1.4 kB
/** * alias for a constructor type */ export declare type Class<T> = new (...args: any[]) => T; export declare class Dynamic { } /** * */ export declare type ParameterDecorator = (target: any, propertyKey: PropertyKey, index: number) => any; /** * represents a location in a region (memory arena) */ export declare class Address { readonly value: number; constructor(region: Region | number); } /** * a value that is resolvable on either the client-side or the server-side */ export declare type Pointer<T> = { readonly value: T; readonly address: Address; } & T; /** * guard allowing use of pointers as addresses * @param t the value to check */ export declare function isPointer<T>(t: Pointer<T> | Address): boolean; /** * allocate a value into a pointer * @param value the value to allocate * @param region the region to allocate into */ export declare function allocate<T>(value: T, region?: Region): Pointer<T>; export declare class Regions { static regions: Map<string | number, Region>; } /** * a contiguous set of memory locations */ export declare class Region { static value: number; values: any[]; constructor(name?: string); address(): number; addressOf<T>(t: T): Address; move<T>(ptr: Pointer<T>, target: Region): Pointer<T> | undefined; delete<T>(address: Address): T | null; } export declare const DefaultRegion: Region;