bytefun-wxapp
Version:
ByteFun JavaScript SDK
231 lines (227 loc) • 7.53 kB
TypeScript
// Generated by dts-bundle-generator v8.1.2
export declare class NetworkError extends Error {
status: number;
constructor(message: string);
}
declare class HashMap<K, V> {
private keys;
private values;
constructor(obj?: Record<any, any>);
put(key: K, value: V): void;
get(key: K): V;
getKey(index: number): K;
getVal(index: number): V;
has(key: K): boolean;
remove(key: K): void;
putAll(map: HashMap<K, V>): void;
size(): number;
clear(): void;
getKeys(): K[];
getValues(): V[];
clone(): HashMap<K, V>;
containsKey(key: K): boolean;
isEmpty(): boolean;
forEach(callbackfn: (value: V, key: K) => any): void;
toObject(): any;
toJSONString(): string;
[Symbol.iterator](): IterableIterator<[
K,
V
]>;
}
export declare class NetRequest {
static readonly METHOD_GET = 0;
static readonly METHOD_POST = 1;
static readonly METHOD_PUT = 2;
static readonly METHOD_DELETE = 3;
private reqURL;
private internal;
private tag;
method: number;
header: Record<string, any>;
private postParam;
constructor(url: string);
setMethod(method: number): void;
getParam(): Record<string, any>;
getParamToString(): string;
setPostParam(postParam: HashMap<string, any> | Array<any> | string): void;
getReqURL(): string;
setReqURL(reqURL: string): void;
getTag(): any;
setTag(tag: any): void;
setInternal(internal: boolean): void;
isInternal(): boolean;
setHeader(header: HashMap<string, any>): void;
}
export declare class WrapViewAndData {
view: any;
urlBg: string;
viewW: number;
viewH: number;
bgImgStyle: number;
}
export interface IByteFunView {
}
export interface ImageLoadCallback {
failure: (event: any) => void;
success: (event: any) => void;
}
export interface ImageView {
loadImage(url: string, callback: ImageLoadCallback): void;
}
export interface IImageModel {
src: string;
defaultImg: string;
failImg: string;
scaleType: number;
otherStationSrc: string;
otherStationRound: number;
isSvg: number;
svgColor: string;
}
export interface IWXAuthEvent {
authCode: string;
}
export interface IShareWXImageEvent {
url: string;
}
export interface IShareWXBaseMulEvent {
url: string;
title: string;
desc: string;
thumb: string;
scene: number;
}
export interface IShareWXLinkEvent extends IShareWXBaseMulEvent {
}
export interface IShareWXMinAPPEvent extends IShareWXBaseMulEvent {
userName: string;
path: string;
proType: number;
}
export interface IShareWXMusicEvent extends IShareWXBaseMulEvent {
}
export interface IShareWXTextEvent {
text: string;
}
export interface IShareWXVideoEvent extends IShareWXBaseMulEvent {
}
export interface IFilePickEvent {
accept: Array<string>;
exAccept: any;
}
export interface IImageDownLoadCallback {
onSuc(bitmap: any): void;
onFail(e: Error): void;
}
export interface IImageBytesDownLoadCallback {
onSuc(bitmapData: any[]): void;
onFail(e: Error): void;
}
export interface INetCallback {
onFailure(e: Error, netRequest: NetRequest): void;
onResponse(response: any, netRequest: NetRequest): void;
}
export interface IImageToViewCallback {
onSuc(view: any, baseCompModel: IImageModel, drawable: any, wrapViewAndData?: WrapViewAndData): void;
onFail(e: Error, view: ImageView, drawable: any, wrapViewAndData?: WrapViewAndData): void;
}
export interface IWXAuthCallback {
onAuthSuc(code: number, authCode: string): void;
onAuthFail(code: number): void;
onCallWXSuc(code: number): void;
onCallWXFail(code: number): void;
onAuthCancel(code: number): void;
onAuthReject(code: number): void;
}
export interface IWXPayCallback {
onOrderSuc(code: number): void;
onOrderFail(code: number): void;
onCallWXSuc(code: number): void;
onCallWXFail(code: number): void;
onPaySuc(code: number): void;
onPayFail(code: number): void;
onPayCancle(code: number): void;
}
export interface IWXShareCallback {
onFailure(code: number): void;
onResponse(code: number): void;
}
export interface IFileSelectCallback {
onSuc(file: any, path: string): void;
onFail(errMsg: string): void;
}
export interface IQrScanCallback {
onSuc(result: string): void;
onFail(errMsg: string): void;
}
export interface IServerLib {
downloadImg(context: any, imgUrl: string, imgW: number, imgH: number, iImageDownLoadCallback: IImageDownLoadCallback): void;
setImgToImageView(context: any, imageView: ImageView, imageModel: IImageModel, imageCallback: IImageToViewCallback): void;
stopLoadImgToImageView(view: any): void;
addThreadPoolTask(runnable: any): void;
netRequest(netRequest: NetRequest, callback: INetCallback): void;
qrScan(context: any, byteFunView: IByteFunView, callback: IQrScanCallback): void;
wxPay(context: any, netRequest: NetRequest, callback: IWXPayCallback): void;
wxShareText(context: any, shareWXTextEvent: IShareWXTextEvent, iwxShareCallback: IWXShareCallback): void;
wxShareImage(context: any, shareWXImageEvent: IShareWXImageEvent, iwxShareCallback: IWXShareCallback): void;
wxShareLink(context: any, shareWXLinkEvent: IShareWXLinkEvent, iwxShareCallback: IWXShareCallback): void;
wxShareMusic(context: any, shareWXMusicEvent: IShareWXMusicEvent, iwxShareCallback: IWXShareCallback): void;
wxShareVideo(context: any, shareWXVideoEvent: IShareWXVideoEvent, iwxShareCallback: IWXShareCallback): void;
wxShareMinApp(context: any, shareWXMinAPPEvent: IShareWXMinAPPEvent, iwxShareCallback: IWXShareCallback): void;
savePageCacheData(context: any, pageID: string, pageData: string): void;
loadPageCacheData(context: any, pageID: string): string;
delPageCacheData(context: any, pageID: string): void;
wxAuth(context: any, wxAuthEvent: IWXAuthEvent, iwxAuthCallback: IWXAuthCallback): void;
saveSpData(context: any, key: string, data: any): void;
loadSpData(context: any, key: string, dataType: number): any;
md5(data: string): string;
filePick(context: any, filePickEvent: IFilePickEvent, iFileSelectCallback: IFileSelectCallback): void;
}
export interface SignOptions {
pointPool: string;
der: boolean;
hash: boolean;
publicKey: string;
userId: string;
}
export interface SM4Options {
padding: string;
mode: string;
iv: Array<string>;
output: string;
}
export type ISignOptions = Omit<SignOptions, "pointPool" | "publicKey">;
export declare const sm2: {
generateKeyPairHex: () => string;
compressPublicKeyHex: (key: string) => string;
comparePublicKeyHex: (publicKey1: string, publicKey2: string) => boolean;
doEncrypt: (msg: string, publicKey: string, chipherModel?: number) => string;
doDecrypt: (encryptData: string, privateKey: string, chipherModel?: number) => string;
doSignature: (signData: string, privateKey: string, options: SignOptions) => string;
doVerifySignature: (msg: string, signHex: String, publicKey: string, options: ISignOptions) => boolean;
getPublicKeyFromPrivateKey: (privateKey: string) => string;
getPoint: () => string;
verifyPublicKey: (publicKey: string) => boolean;
};
export declare function sm3(message: string): string;
export declare const sm4: {
encrypt: (inArray: string, key: string, options?: SM4Options) => string;
decrypt: (inArray: string, key: string, options?: SM4Options) => string;
};
export declare const md5: (str: string) => string;
export interface SdkOption {
app: any;
serverLib: IServerLib;
appId: string;
appKey: string;
require: (url:string) => any;
}
export declare class ByteFunSDK {
static init(option: SdkOption): void;
static pageLoad(page:any,options: any): void;
static setBizFunction(bizFunction: any): void;
static setBizVar(bizVar: any): void;
static setBizCallback(bizCallback: any): void;
}
export {};