multyx-client
Version:
Framework designed to simplify the creation of multiplayer browser games by addressing the complexities of managing server-client communication, shared state, and input handling
31 lines (30 loc) • 1.11 kB
TypeScript
import type Multyx from '../';
import { Constraint, RawObject, Value } from "../types";
import { Edit, EditWrapper, Unpack } from '../utils';
export default class MultyxClientValue {
private _value;
private multyx;
propertyPath: string[];
editable: boolean;
constraints: {
[key: string]: Constraint;
};
private readModifiers;
private editCallbacks;
get value(): Value;
set value(v: Value);
addReadModifier(modifier: (value: Value) => Value): void;
addEditCallback(callback: (value: Value, previousValue: Value) => void): void;
[Edit](updatePath: string[], value: any): void;
constructor(multyx: Multyx, value: Value | EditWrapper<Value>, propertyPath: string[], editable: boolean);
set(value: Value | EditWrapper<Value>): boolean;
bindElement(element: HTMLElement): void;
/**
* Unpack constraints sent from server and store
* @param constraints Packed constraints from server
*/
[Unpack](constraints: RawObject): void;
toString: () => string;
valueOf: () => Value;
[Symbol.toPrimitive]: () => Value;
}