platform.d.ts 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import { ETargetPlatform, EElementType } from './types.js';
  2. export interface IPlatformConstants {
  3. name: ETargetPlatform;
  4. tellIfInThisPlatform: () => boolean;
  5. pageEvents: string[];
  6. pageLifeCycleToMount: string;
  7. pageLifeCycleToUnmount: string;
  8. componentEvents: string[];
  9. componentPageEvents: string[];
  10. blockedProperty: string[];
  11. componentLifeCycleToMount: string;
  12. componentLifeCycleToUnmount: string;
  13. getPropsFromInstance: (instance: any, propNames: string[]) => Record<string, any>;
  14. buildOptions: (elementType: EElementType, props: any, data: any, lifeCycleHandlers: any, userEventHandlers: any, options: any, observers: any, componentPageLifeCycleHandlers: any) => Record<string, any>;
  15. supportHandleEventResult: boolean;
  16. }
  17. export interface IWechatProperty {
  18. [name: string]: {
  19. type: any;
  20. value: any;
  21. };
  22. }
  23. export declare const checkIfPlatformIsLoadCorrectly: (config: IPlatformConstants, target: ETargetPlatform) => boolean;
  24. export declare const commonPageEvents: {
  25. onLoad: string;
  26. onShow: string;
  27. onReady: string;
  28. onHide: string;
  29. onPullDownRefresh: string;
  30. onReachBottom: string;
  31. onShareAppMessage: string;
  32. onPageScroll: string;
  33. onTabItemTap: string;
  34. onResize: string;
  35. onUnload: string;
  36. };
  37. export declare const alipayPageEvents: {
  38. onTitleClick: string;
  39. onOptionMenuClick: string;
  40. beforeTabItemTap: string;
  41. onKeyboardHeight: string;
  42. onBack: string;
  43. onSelectedTabItemTap: string;
  44. beforeReload: string;
  45. };
  46. export declare const commonComponentPageEvents: {
  47. 'page:show': string;
  48. 'page:hide': string;
  49. };
  50. export type ComponentPageEvents = keyof typeof commonComponentPageEvents;
  51. /**
  52. * @see https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/lifetimes.html
  53. */
  54. export declare const wechatComponentPageEvents: Record<ComponentPageEvents, string>;
  55. /**
  56. * @see https://opendocs.alipay.com/mini/framework/page-detail#events
  57. */
  58. export declare const alipayComponentPageEvents: Record<ComponentPageEvents, string>;
  59. export declare const commonComponentEvents: Record<string, string>;
  60. export declare const alipayComponentEvents: {
  61. onInit: string;
  62. didMount: string;
  63. didUpdate: string;
  64. deriveDataFromProps: string;
  65. didUnmount: string;
  66. };
  67. export declare const wechatComponentEvents: {
  68. error: string;
  69. };
  70. export declare const blockedProperty: string[];
  71. export declare const platformConfig: Record<ETargetPlatform, IPlatformConstants>;