@zxh19890103/wik
Version:
The world-class JavaScript library for building large-scale digital warehouse both on 2D and 3D.
49 lines (48 loc) • 1.95 kB
TypeScript
import { AbstractConstructor, Constructor } from '../../interfaces';
/**
* 向一个对象写入一个只读属性
*/
export declare function writeReadonlyProp(o: object, name: string, value: any): void;
/**
* 向一个对象写入一个属性,可写,不可删,不可枚举
*/
export declare function writeProp(o: object, name: string, value: any): void;
/**
* Mixin is a abstract subclass based on a super class.
*
* @see https://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes/
*/
export type Mixin<B extends object, M> = (b: Constructor<B>) => Constructor<B & M>;
declare function _with<B extends object, M0>(m0: Mixin<B, M0>): Constructor<B & M0>;
declare function _with<B extends object, M0, M1>(m0: Mixin<B, M0>, m1: Mixin<B, M1>): Constructor<B & M0 & M1>;
declare function _with<B extends object, M0, M1, M2>(m0: Mixin<B, M0>, m1: Mixin<B, M1>, m2: Mixin<B, M2>): Constructor<B & M0 & M1 & M2>;
declare function _with<B extends object, M0, M1, M2, M3>(m0: Mixin<B, M0>, m1: Mixin<B, M1>, m2: Mixin<B, M2>, m3: Mixin<B, M3>): Constructor<B & M0 & M1 & M2 & M3>;
interface MixReturns {
with: typeof _with;
}
/**
* @mix
* A language-suger for mix-with
*/
export declare function mix<B extends object>(b: Constructor<B>): MixReturns;
/**
* @decorator
*
* Warn! just mix own methods in.
*
* constructor IS excluded!
*/
export declare function mixin(...features: Array<object | Constructor>): (to: any) => void;
/**
* 为 class 设置别名
* 注意,只对方法成员有效
* @decorator
*/
export declare function alias(name: string | Record<string, string>, aliasTo?: string): (target: AbstractConstructor) => void;
/**
* 将 src 上的方法关联到目标 class 上,同时指定一个方法名称,
* 注意,只对方法成员有效
* @decorator
*/
export declare function link(src: AbstractConstructor, pairs: Record<string, string>): (dest: AbstractConstructor) => void;
export {};