@formily/core
Version:
English | [简体中文](./README.zh-cn.md)
33 lines (32 loc) • 1.22 kB
TypeScript
import { Subscribable } from '@formily/shared';
import { FormLifeCycleHandler } from '../types';
export declare class FormLifeCycle<Payload = any> {
private listener;
constructor(handler: FormLifeCycleHandler<Payload>);
constructor(type: string, handler: FormLifeCycleHandler<Payload>);
constructor(handlerMap: {
[key: string]: FormLifeCycleHandler<Payload>;
});
buildListener(params: any[]): (payload: {
type: string;
payload: Payload;
}, ctx: any) => void;
notify: <Payload_1>(type: any, payload: Payload_1, ctx?: any) => void;
}
export declare class FormHeart<Payload = any, Context = any> extends Subscribable {
private lifecycles;
private context;
private beforeNotify?;
private afterNotify?;
private batching?;
private buffer?;
constructor({ lifecycles, context, beforeNotify, afterNotify }?: {
lifecycles?: FormLifeCycle[];
context?: Context;
beforeNotify?: (...args: any[]) => void;
afterNotify?: (...args: any[]) => void;
});
buildLifeCycles(lifecycles: FormLifeCycle[]): any;
batch: (callback?: () => void) => void;
publish: <P, C>(type: any, payload: P, context?: C) => void;
}