| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- /// <reference types="@tarojs/taro" />
- declare module '*.png';
- declare module '*.gif';
- declare module '*.jpg';
- declare module '*.jpeg';
- declare module '*.svg';
- declare module '*.css';
- declare module '*.less';
- declare module '*.scss';
- declare module '*.sass';
- declare module '*.styl';
- declare namespace NodeJS {
- interface ProcessEnv {
- /** NODE 内置环境变量, 会影响到最终构建生成产物 */
- NODE_ENV: 'development' | 'production';
- /** 当前构建的平台 */
- TARO_ENV:
- | 'weapp'
- | 'swan'
- | 'alipay'
- | 'h5'
- | 'rn'
- | 'tt'
- | 'qq'
- | 'jd'
- | 'harmony'
- | 'jdrn';
- /**
- * 当前构建的小程序 appid
- * @description 若不同环境有不同的小程序,可通过在 env 文件中配置环境变量`TARO_APP_ID`来方便快速切换 appid, 而不必手动去修改 dist/project.config.json 文件
- * @see https://taro-docs.jd.com/docs/next/env-mode-config#特殊环境变量-taro_app_id
- */
- TARO_APP_ID: string;
- USE_MSW?: string;
- }
- }
- // Webpack 注入的全局常量
- declare const API_BASE_URL_FROM_WEBPACK: string;
- declare const MQTT_BROKER_URL_FROM_WEBPACK: string;
- // Electron API 类型定义
- declare global {
- interface Window {
- // Electron 主要 API
- electronAPI?: {
- // 系统操作
- exitApp: () => Promise<{ success: boolean }>;
- shutdownSystem: () => Promise<{
- success: boolean;
- error?: string;
- requiresAdmin?: boolean;
- }>;
- // 摄像头权限
- checkCameraPermission?: () => Promise<boolean>;
- requestCameraPermission?: () => Promise<boolean>;
- // 文件保存
- saveFile: (options: {
- data: ArrayBuffer;
- defaultFilename: string;
- filters?: Array<{ name: string; extensions: string[] }>;
- title?: string;
- }) => Promise<{
- success: boolean;
- filePath?: string;
- canceled?: boolean;
- error?: string;
- }>;
- };
- // Electron 存储 API
- electronStorage?: {
- getItem: (key: string) => Promise<string | null>;
- setItem: (key: string, value: string) => Promise<void>;
- removeItem: (key: string) => Promise<void>;
- };
- }
- }
- // Cordova API 类型定义
- declare global {
- interface Window {
- cordova?: any;
- // Cordova 文件系统 API
- resolveLocalFileSystemURL?: (
- path: string,
- successCallback: (entry: any) => void,
- errorCallback?: (error: any) => void
- ) => void;
- }
- interface Navigator {
- camera?: {
- getPicture: (
- successCallback: (imageData: string) => void,
- errorCallback: (error: string) => void,
- options: any
- ) => void;
- };
- }
- // Cordova Device 插件类型定义
- interface CordovaDevice {
- cordova: string;
- model: string;
- platform: string;
- uuid: string;
- version: string;
- manufacturer: string;
- isVirtual: boolean;
- serial: string;
- }
- const device: CordovaDevice;
- // Cordova Camera 插件类型定义
- const Camera: {
- DestinationType: {
- DATA_URL: number;
- FILE_URI: number;
- NATIVE_URI: number;
- };
- PictureSourceType: {
- PHOTOLIBRARY: number;
- CAMERA: number;
- SAVEDPHOTOALBUM: number;
- };
- EncodingType: {
- JPEG: number;
- PNG: number;
- };
- MediaType: {
- PICTURE: number;
- VIDEO: number;
- ALLMEDIA: number;
- };
- };
- }
- export {};
|