pcom-isv-base
Version:
千叶ISV基础能力
174 lines (173 loc) • 5.69 kB
TypeScript
/// <reference types="node" />
import * as goldlog from '../goldlog';
import izTool from '../izTool';
import { MtopRule } from '../mtop';
import { ToastRule } from '../toast';
import { LocalStorageRule } from '../localStorage';
import { PoplayerRule } from '../poplayer';
import { TbliveRule } from '../tblive';
import { NavigationRule } from '../navigation';
import { DocumentRule } from '../document';
import { AllowedHostRule } from '../allowedHost';
import { ShopRule } from '../shop';
import { CopyToClipboardRule } from '../copyToClipboard';
import { ShareRule } from '../share';
import { StoreRule } from '../store';
import { GlobalRule } from '../global';
import { ScreenRule } from '../screen';
import { SaveImageRule } from '../saveImage';
import { CameraRule } from '../camera';
import { MiniAppRule } from '../miniapp';
export interface RuleMap {
document?: DocumentRule[];
allowedHost?: AllowedHostRule[];
mtop?: MtopRule[];
commonMtop?: MtopRule[];
shop?: ShopRule[];
navigation?: NavigationRule[];
toast?: ToastRule[];
localStorage?: LocalStorageRule[];
poplayer?: PoplayerRule[];
tblive?: TbliveRule[];
copyToClipboard?: CopyToClipboardRule[];
share?: ShareRule[];
store?: StoreRule[];
global?: GlobalRule[];
screen?: ScreenRule[];
saveImage?: SaveImageRule[];
camera?: CameraRule[];
miniapp?: MiniAppRule[];
}
declare const _mtop: (api: string, data?: any, config?: import("../mtop").MtopConfig) => Promise<any>;
declare const _auth: {
isLogin: () => Promise<import("../auth").UserInfo>;
login: () => Promise<any>;
};
declare const _global: {
Promise: {
(...args: any[]): any;
resolve: any;
all: any;
race: any;
reject: any;
};
console: {
log: (...args: any[]) => void;
warn: (...args: any[]) => void;
};
scrollTo: (x: number, y: number) => void;
requestAnimationFrame: (callback?: FrameRequestCallback) => number;
cancelAnimationFrame: (handle: number) => void;
setTimeout: (fn: Function, timer: number) => NodeJS.Timeout | 0;
clearTimeout: (id: any) => number;
setInterval: (fn: any, timer: any) => NodeJS.Timeout | 0;
clearInterval: (id: any) => number;
alert: (...args: any[]) => void;
};
declare const _toast: (text: any, duration?: number) => void;
declare const _localStorage: import("../localStorage").LocalStorage;
declare const _poplayer: {
display: () => void;
close: (needFinish?: boolean) => void;
getTriggerEventInfo: () => Promise<unknown>;
increaseReadTimes: (times?: number) => void;
isPoplayer: () => Promise<unknown>;
};
declare const _tblive: {
follow: (accountId: string | number) => void;
invokeEditor: (content?: string) => void;
addFavor: () => void;
showSharePanel: () => void;
showGoodsPackage: () => void;
};
declare const _shop: {
hasFollowed: (sellerId: string) => Promise<boolean>;
addFollow: (sellerId: string, originBiz?: string, originPage?: string) => Promise<boolean>;
};
declare const _copyToClipboardRule: (text: string) => Promise<boolean>;
declare const _screen: {
capture: (type?: "view" | "app", inAlbum?: boolean) => Promise<any>;
onScroll: (cb?: (options: {
scrollTop: number;
}) => void) => void;
};
declare const _miniapp: {
addFavorite: (miniappId: string) => Promise<import("../miniapp").MiniAppInfo>;
removeFavorite: (miniappId: string) => Promise<boolean>;
isMyFavorite: (miniappId: string) => Promise<boolean>;
};
declare const _store: {
set?: undefined;
get?: undefined;
update?: undefined;
on?: undefined;
event?: undefined;
} | {
set: (data: {
[key: string]: any;
}) => any;
get: (name?: string) => any;
update: (path: string, data: any) => any;
on: (path: string, callback: (value: any) => void, forceInit?: boolean) => any;
event: {
on: (name: string, listener: any) => void;
off: (name: string, listener?: any) => void;
emit: (name: string, ...args: any[]) => void;
};
};
declare const _share: import("../share").Index;
declare const _camera: {
takePhoto: (options?: import("../camera").Options) => Promise<string>;
};
declare const _env: {
isIOS: boolean;
isAndroid: boolean;
isWeex: boolean;
isTB: boolean;
isTM: boolean;
appName: string;
isIphoneX: boolean;
statusBarHeight: number;
navBarHeight: number;
bottomBarHeight: number;
isWeb: boolean;
clientHeight: number;
clientWidth: number;
isPreview: boolean;
};
declare const _navigation: {
getQuery: (name: string) => string;
getQueries: () => {
[key: string]: string | string[];
};
getPageSpm: () => string;
pushWindow: (url: string, spmC?: string, spmD?: string) => void;
pushWindowWithReplace: (url: string, spmC?: string, spmD?: string) => void;
popWindow: () => void;
};
declare const _saveImage: ({ url }: {
url: any;
}) => Promise<unknown>;
export interface Base {
mtop: typeof _mtop;
auth: typeof _auth;
global: typeof _global;
toast: typeof _toast;
localStorage: typeof _localStorage;
poplayer: typeof _poplayer;
tblive: typeof _tblive;
shop: typeof _shop;
copyToClipboard: typeof _copyToClipboardRule;
screen: typeof _screen;
saveImage: typeof _saveImage;
miniapp: typeof _miniapp;
store: typeof _store;
share: typeof _share;
camera: typeof _camera;
goldlog: typeof goldlog;
izTool: typeof izTool;
env: typeof _env;
navigation: typeof _navigation;
}
export default function index(ruleMap: RuleMap, projectName: string): Base;
export {};