@needle-tools/engine
Version:
Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development with great integrations into editors like Unity or Blender - and can be deployed onto any device! It is flexible, extensible and networking and XR are built-in.
50 lines (49 loc) • 1.9 kB
TypeScript
import { type Constructor } from "./engine_types.js";
export declare type TypeResolver<T> = (data: any) => Constructor<T> | null;
/** Please use {@link serializable} - this version has a typo and will be removed in future versions */
export declare const serializeable: <T>(type?: Constructor<T> | null | Array<Constructor<any> | TypeResolver<T>> | TypeResolver<T>) => (_target: any, _propertyKey: string | {
name: string;
}) => void;
/**
* Marks a field for serialization and editor exposure. Required for fields that reference
* other objects, components, or assets. Primitive types (string, number, boolean) work without a type argument.
*
* @param type The constructor type for complex objects. Omit for primitives.
*
* @example Primitive types (no type needed)
* ```ts
* @serializable()
* speed: number = 1;
*
* @serializable()
* label: string = "Hello";
* ```
* @example Object references
* ```ts
* @serializable(Object3D)
* target: Object3D | null = null;
*
* @serializable(Renderer)
* myRenderer: Renderer | null = null;
* ```
* @example Arrays
* ```ts
* @serializable([Object3D])
* waypoints: Object3D[] = [];
* ```
* @see {@link syncField} for automatic network synchronization
* @link https://engine.needle.tools/docs/reference/typescript-decorators.html#serializable
*/
export declare const serializable: <T>(type?: Constructor<T> | null | Array<Constructor<any> | TypeResolver<T>> | TypeResolver<T>) => (_target: any, _propertyKey: string | {
name: string;
}) => void;
/** @internal */
export declare const ALL_PROPERTIES_MARKER = "__NEEDLE__ALL_PROPERTIES";
/** @internal @deprecated current not used */
export declare function allProperties(constructor: Function): void;
/**
* @internal
*/
export declare const STRICT_MARKER = "__NEEDLE__STRICT";
/** @deprecated current not used */
export declare function strict(constructor: Function): void;