platform.d.ts 637 B

1234567891011121314
  1. export declare const DEFAULT_FONT_SIZE = 12;
  2. export declare const DEFAULT_FONT_FAMILY = "sans-serif";
  3. export declare const DEFAULT_FONT: string;
  4. interface Platform {
  5. createCanvas(): HTMLCanvasElement;
  6. measureText(text: string, font?: string): {
  7. width: number;
  8. };
  9. loadImage(src: string, onload: () => void | HTMLImageElement['onload'], onerror: () => void | HTMLImageElement['onerror']): HTMLImageElement;
  10. }
  11. export declare const DEFAULT_TEXT_WIDTH_MAP: Record<string, number>;
  12. export declare const platformApi: Platform;
  13. export declare function setPlatformAPI(newPlatformApis: Partial<Platform>): void;
  14. export {};