miniapp-web-jsapi
Version:
JSAPI/View adapter for miniprogram running on the web
82 lines (81 loc) • 2.24 kB
TypeScript
/// <reference types="mini-types" />
import { AppNameEnums, SiteNameEnums } from './site';
import { IRpcInterceptor } from './rpc';
export declare const cssPrefix = "alipay-mwj";
export declare const getPrefixCls: (name: string) => string;
export interface RpcOptions {
appId?: string;
workspaceId?: string;
gatewayUrl?: string;
headers?: {
[key: string]: string;
};
rpcInterceptor?: IRpcInterceptor;
}
export interface IBuildNavigateUrlParams extends my.INavigateToMiniProgram {
parameters?: Record<string, any>;
}
export interface NavigateOptions {
/**
* 构建跳转到其他小程序的 URL. . 不指定则使用默认实现构建
*/
buildNavigateToAppUrl?: (options: IBuildNavigateUrlParams) => string;
}
export interface WebPolyfillOptions {
/**
* 小程序 AppId. 不指定则从 URL 获取
*/
appId?: string;
/**
* 所在站点. 不指定则从 URL 获取
*/
siteName?: SiteNameEnums | string;
/**
* 所属钱包 App. 不指定则从 URL 获取
*/
appName?: AppNameEnums | string;
/**
* Rpc 实现所用
*/
rpcOptions?: RpcOptions;
/**
* navigate 相关扩展
*/
navigateOptions?: NavigateOptions;
}
export declare function initWebPolyfill(options: WebPolyfillOptions): void;
export declare function getWebPolyfillOptions(): WebPolyfillOptions | undefined;
/**
* https://host:port/path-name?site=xxx&app=xxx&query=...referrerInfo=...#/hashPath?hashQuery
*/
export interface IWebQueryParams {
[key: string]: any;
site?: string;
app?: string;
/**
* 打开 App 携带的参数
*/
query?: any;
/**
* 打开 App 携带的 referrer 信息
*/
referrerInfo?: any;
/**
* hash 路径. 如 /pages/main/main
*
*/
hashPath?: string;
/**
* hash 中携带的参数
*/
hashQuery?: any;
}
export declare function getWebQueryParams(): IWebQueryParams;
export declare enum EnvironmentEnums {
STABLE = "STABLE",
TEST = "TEST",
PRE = "PRE",
PROD = "PROD"
}
export declare function getEnvironment(): EnvironmentEnums;
export declare function buildNavigateUrl(options: IBuildNavigateUrlParams): string;