hooks.d.ts 1.2 KB

123456789101112131415161718192021222324252627282930
  1. import HandlersController from './handlers.js';
  2. import { IPlatformConstants } from './platform.js';
  3. import { ETargetPlatform } from './types.js';
  4. export type THooksFn = (handler: Function, deps?: any[]) => void;
  5. export declare const reactContext: import("preact").Context<IElementContext | null>;
  6. export interface IElementContext {
  7. instance: any;
  8. handlersController: HandlersController;
  9. ifServerRender?: boolean;
  10. debugLog?: (...args: any[]) => void;
  11. platformConfig: IPlatformConstants;
  12. }
  13. export declare function useStableCallback<T extends Function>(callback: T): T;
  14. type DepsOrOptions = {
  15. /**
  16. * 是否需要消费 event 的返回结果
  17. */
  18. handleResult?: boolean;
  19. } | any[];
  20. export declare function useEvent(name: string, handler: Function,
  21. /**
  22. *
  23. */
  24. depsOrOptions?: DepsOrOptions): void;
  25. export declare function getLifeCycleHooks(eventName: string, disableMultiImpl?: boolean, specifyPlatform?: ETargetPlatform): THooksFn;
  26. export declare function useSyncMiniData(data?: {}): void;
  27. declare function useMiniInstance<T = any>(): T;
  28. export declare const usePage: typeof useMiniInstance;
  29. export declare const useComponent: typeof useMiniInstance;
  30. export {};