@ray-core/runtime
Version:
Ray 是一个全新的基于 React 的小程序开发框架
51 lines (50 loc) • 1.51 kB
TypeScript
import { FiberRoot } from 'react-reconciler';
import VNode, { RawNode } from './VNode';
import AppContainer from './AppContainer';
interface SpliceUpdate {
path: string[];
children?: RawNode[];
id: number;
raw: RawNode | null;
type: 'splice';
node: VNode;
}
interface SetUpdate {
path: string[];
name: string;
value: any;
type: 'set';
node: VNode;
}
export default class Container {
context: any;
root: VNode;
rootKey: string;
updateQueue: Array<SpliceUpdate | SetUpdate>;
_rootContainer?: FiberRoot;
stopUpdate?: boolean;
_slot: {
idsCache: number[];
node: VNode | undefined;
};
pageInitialized: boolean;
constructor(context: any, rootKey?: string);
requestUpdate(update: SpliceUpdate | SetUpdate): void;
normalizeUpdatePath(paths: string[]): string;
handlePayload(pathPrefix: string[]): {
[key: string]: any;
};
applyUpdate(appContainer?: AppContainer): void;
clearUpdate(): void;
createCallback(id: string, propKey: string, node: VNode, fn: (...params: any) => any): void;
removeCallback(name: string): void;
appendChild(child: VNode): void;
removeChild(child: VNode): void;
insertBefore(child: VNode, beforeChild: VNode): void;
replaceSlot(parent: VNode, child: VNode, index?: number): VNode[] | undefined;
removeSlot(parent: VNode, child: VNode): void;
copyVNode(node: VNode, option?: {
parent?: VNode;
}): any;
}
export {};