coolink
Version:
Coocaa Coolink APP JavaScript library
97 lines (96 loc) • 3.23 kB
TypeScript
import Widget from './Widget';
import { RenderData } from '../types/type';
export declare type PropChildrenVNodeType = VNode | VNode[];
declare type W = Widget<any, any>;
declare type Key = string | number | void;
declare type Ref = ((widget: W) => void) | void;
export interface PropChildrenVNode {
[childrenPropName: string]: PropChildrenVNodeType;
}
interface NodeEvents {
[eventName: string]: Function;
}
interface VNodeUpdateInfo {
updateNodeId: string;
invokeUpdateNodeId: string;
}
export default class VNode {
type: string;
props: any;
parent: VNode | void;
children: VNode[];
basicWidgetPropChildren: PropChildrenVNode;
widget: W;
widgetBuilder: any;
isBasicWidget: boolean;
childrenMapedName: string;
childrenIsArray: boolean;
nodeId: string;
nativeViewId?: string;
events: NodeEvents;
pageName?: string;
pageNode: VNode | void;
hasMount: boolean;
contextId: string;
isPageNode: boolean;
isNativeViewNode: boolean;
isInputNode: boolean;
key?: Key;
parentKey?: Key;
ref?: Ref;
updateInfo?: VNodeUpdateInfo;
shouldRender: boolean;
private _refHasMount;
static nodeIdIndex: number;
static getNodeId(type: string): string;
static asyncEventTypes: string[];
static eventTypes: string[];
static throttledEventTypes: string[];
constructor({ type, props, widgetBuilder, isBasicWidget, childrenMapedName, childrenIsArray, parent, key, ref, }: {
type: string;
props: any;
widgetBuilder: any;
isBasicWidget: boolean;
childrenMapedName: string;
childrenIsArray: boolean;
parent?: VNode | void;
key?: Key;
ref?: Ref;
});
findVNodeInProps(): void;
findEventsInProps(): void;
doRender(): void;
doUpdate(): VNode | void;
doMerge(oldNode: VNode): void;
toRenderData(pageName: string, setStateful?: boolean): RenderData;
private execPropsProvider;
fetch(targetNodeId: string): VNode;
fetchNearlyCanUpdateBasicNode(): VNode;
fetchNearlyCustomNode(): VNode;
fetchNearlyBasicNode(): VNode;
fetchRootNode(): VNode;
fetchNodePageName(): string;
isSameAs(otherNode: VNode): boolean;
invokeEvent(targetNodeId: string, eventId: string, eventType: string, params: any): Promise<void>;
stopAsyncEvent(node: VNode, eventType: string): void;
invokeLifeCycle(lifeStep: string): void;
private _invokeChildrenLifeCycle;
private _invokeMountRef;
appendChild(child: VNode, target?: VNode[]): void;
removeChild(child: VNode, target?: VNode[]): void;
appendChildInArrayProps(child: VNode, propName: string): void;
private mapChildren;
private getTargetChildrenArrayInPropChildren;
}
export declare class LifeCycle {
private static lifes;
static widgetDidMount: string;
static widgetDidUpdate: string;
static widgetDidUnmount: string;
static pageDidPush: string;
static pageDidPop: string;
static pageDidPopNext: string;
static pageDidPushNext: string;
static isExist(lifeStep: string): boolean;
}
export {};