@hairy/wechat-jssdk 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -0
- package/index.cjs.js +247 -0
- package/index.d.ts +112 -0
- package/index.esm.js +243 -0
- package/index.iife.js +248 -0
- package/index.iife.min.js +1 -0
- package/package.json +16 -0
package/README.md
ADDED
|
File without changes
|
package/index.cjs.js
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var core = require('@hairy/core');
|
|
6
|
+
|
|
7
|
+
const loadScript = (source, onLoaded = core.noop, options = {}) => {
|
|
8
|
+
const {
|
|
9
|
+
type = "text/javascript",
|
|
10
|
+
async = true,
|
|
11
|
+
crossOrigin,
|
|
12
|
+
referrerPolicy,
|
|
13
|
+
noModule,
|
|
14
|
+
defer,
|
|
15
|
+
waitForScriptLoad = true
|
|
16
|
+
} = options;
|
|
17
|
+
return new Promise((resolve, reject) => {
|
|
18
|
+
let shouldAppend = false;
|
|
19
|
+
let element = document.querySelector(`script[src="${source}"]`);
|
|
20
|
+
if (!element) {
|
|
21
|
+
element = document.createElement("script");
|
|
22
|
+
element.type = type;
|
|
23
|
+
element.async = async;
|
|
24
|
+
element.src = source;
|
|
25
|
+
if (defer)
|
|
26
|
+
element.defer = defer;
|
|
27
|
+
if (crossOrigin)
|
|
28
|
+
element.crossOrigin = crossOrigin;
|
|
29
|
+
if (noModule)
|
|
30
|
+
element.noModule = noModule;
|
|
31
|
+
if (referrerPolicy)
|
|
32
|
+
element.referrerPolicy = referrerPolicy;
|
|
33
|
+
shouldAppend = true;
|
|
34
|
+
} else if (element.hasAttribute("data-loaded")) {
|
|
35
|
+
resolve(element);
|
|
36
|
+
}
|
|
37
|
+
element.addEventListener("error", (event) => reject(event));
|
|
38
|
+
element.addEventListener("abort", (event) => reject(event));
|
|
39
|
+
element.addEventListener("load", () => {
|
|
40
|
+
element.dataset.loaded = "true";
|
|
41
|
+
onLoaded(element);
|
|
42
|
+
resolve(element);
|
|
43
|
+
});
|
|
44
|
+
if (shouldAppend) {
|
|
45
|
+
element = document.head.appendChild(element);
|
|
46
|
+
}
|
|
47
|
+
if (!waitForScriptLoad) {
|
|
48
|
+
resolve(element);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
class WechatJssdkHelper {
|
|
54
|
+
constructor(options) {
|
|
55
|
+
this.isReady = false;
|
|
56
|
+
const { immediate = true, version, requestConfig } = options;
|
|
57
|
+
this.version = version || "1.3.0";
|
|
58
|
+
this.requestConfig = requestConfig;
|
|
59
|
+
this.loadJssdk();
|
|
60
|
+
if (immediate)
|
|
61
|
+
this.config();
|
|
62
|
+
}
|
|
63
|
+
loadJssdk() {
|
|
64
|
+
const scriptUrl = `https://res.wx.qq.com/open/js/jweixin-${this.version}.js`;
|
|
65
|
+
this.loadPromise = loadScript(scriptUrl).then(() => {
|
|
66
|
+
this.loadPromise = void 0;
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
async config() {
|
|
70
|
+
if (this.configPromise)
|
|
71
|
+
return this.configPromise;
|
|
72
|
+
if (this.loadPromise)
|
|
73
|
+
await this.loadPromise;
|
|
74
|
+
this.configPromise = (async () => {
|
|
75
|
+
wx.config(await this.requestConfig());
|
|
76
|
+
})();
|
|
77
|
+
return this.configPromise;
|
|
78
|
+
}
|
|
79
|
+
async ready() {
|
|
80
|
+
if (this.readyPromise)
|
|
81
|
+
return this.readyPromise;
|
|
82
|
+
if (this.loadPromise)
|
|
83
|
+
await this.loadPromise;
|
|
84
|
+
if (this.isReady)
|
|
85
|
+
return;
|
|
86
|
+
this.readyPromise = new Promise((resolve, reject) => {
|
|
87
|
+
wx.ready(() => {
|
|
88
|
+
this.isReady = true;
|
|
89
|
+
this.readyPromise = void 0;
|
|
90
|
+
resolve();
|
|
91
|
+
});
|
|
92
|
+
wx.error((error) => {
|
|
93
|
+
this.isReady = false;
|
|
94
|
+
this.readyPromise = void 0;
|
|
95
|
+
reject(error);
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
return this.readyPromise;
|
|
99
|
+
}
|
|
100
|
+
async error() {
|
|
101
|
+
return this.ready().catch((error) => error);
|
|
102
|
+
}
|
|
103
|
+
async implement(key, options) {
|
|
104
|
+
if (this.configPromise) {
|
|
105
|
+
await this.configPromise;
|
|
106
|
+
}
|
|
107
|
+
await this.ready();
|
|
108
|
+
wx[key](options);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
class WechatJssdk extends WechatJssdkHelper {
|
|
113
|
+
constructor(options) {
|
|
114
|
+
super(options);
|
|
115
|
+
}
|
|
116
|
+
updateAppMessageShareData(options) {
|
|
117
|
+
return this.implement("updateAppMessageShareData", options);
|
|
118
|
+
}
|
|
119
|
+
updateTimelineShareData(options) {
|
|
120
|
+
return this.implement("updateTimelineShareData", options);
|
|
121
|
+
}
|
|
122
|
+
addCard() {
|
|
123
|
+
return this.implement("addCard");
|
|
124
|
+
}
|
|
125
|
+
checkJsApi(options) {
|
|
126
|
+
return this.implement("checkJsApi", options);
|
|
127
|
+
}
|
|
128
|
+
chooseCard(options) {
|
|
129
|
+
return this.implement("chooseCard", options);
|
|
130
|
+
}
|
|
131
|
+
chooseImage(options) {
|
|
132
|
+
return this.implement("chooseImage", options);
|
|
133
|
+
}
|
|
134
|
+
chooseWXPay(options) {
|
|
135
|
+
return this.implement("chooseWXPay", options);
|
|
136
|
+
}
|
|
137
|
+
closeWindow() {
|
|
138
|
+
return this.implement("closeWindow");
|
|
139
|
+
}
|
|
140
|
+
consumeAndShareCard(options) {
|
|
141
|
+
return this.implement("consumeAndShareCard", options);
|
|
142
|
+
}
|
|
143
|
+
downloadImage(options) {
|
|
144
|
+
return this.implement("downloadImage", options);
|
|
145
|
+
}
|
|
146
|
+
downloadVoice(options) {
|
|
147
|
+
return this.implement("downloadVoice", options);
|
|
148
|
+
}
|
|
149
|
+
getLocalImgData(options) {
|
|
150
|
+
return this.implement("getLocalImgData", options);
|
|
151
|
+
}
|
|
152
|
+
getLocation(options) {
|
|
153
|
+
return this.implement("getLocation", options);
|
|
154
|
+
}
|
|
155
|
+
getNetworkType(options) {
|
|
156
|
+
return this.implement("getNetworkType", options);
|
|
157
|
+
}
|
|
158
|
+
hideAllNonBaseMenuItem() {
|
|
159
|
+
return this.implement("hideAllNonBaseMenuItem");
|
|
160
|
+
}
|
|
161
|
+
hideMenuItems(options) {
|
|
162
|
+
return this.implement("hideMenuItems", options);
|
|
163
|
+
}
|
|
164
|
+
hideOptionMenu() {
|
|
165
|
+
return this.implement("hideOptionMenu");
|
|
166
|
+
}
|
|
167
|
+
onMenuShareAppMessage(options) {
|
|
168
|
+
return this.implement("onMenuShareAppMessage", options);
|
|
169
|
+
}
|
|
170
|
+
onMenuShareQQ(options) {
|
|
171
|
+
return this.implement("onMenuShareQQ", options);
|
|
172
|
+
}
|
|
173
|
+
onMenuShareQZone(options) {
|
|
174
|
+
return this.implement("onMenuShareQZone", options);
|
|
175
|
+
}
|
|
176
|
+
onMenuShareTimeline(options) {
|
|
177
|
+
return this.implement("onMenuShareTimeline", options);
|
|
178
|
+
}
|
|
179
|
+
onMenuShareWeibo(options) {
|
|
180
|
+
return this.implement("onMenuShareWeibo", options);
|
|
181
|
+
}
|
|
182
|
+
onSearchBeacons(options) {
|
|
183
|
+
return this.implement("onSearchBeacons", options);
|
|
184
|
+
}
|
|
185
|
+
onVoicePlayEnd(options) {
|
|
186
|
+
return this.implement("onVoicePlayEnd", options);
|
|
187
|
+
}
|
|
188
|
+
onVoiceRecordEnd(options) {
|
|
189
|
+
return this.implement("onVoiceRecordEnd", options);
|
|
190
|
+
}
|
|
191
|
+
openCard(options) {
|
|
192
|
+
return this.implement("openCard", options);
|
|
193
|
+
}
|
|
194
|
+
openLocation(options) {
|
|
195
|
+
return this.implement("openLocation", options);
|
|
196
|
+
}
|
|
197
|
+
openProductSpecificView(options) {
|
|
198
|
+
return this.implement("openProductSpecificView", options);
|
|
199
|
+
}
|
|
200
|
+
pauseVoice(options) {
|
|
201
|
+
return this.implement("pauseVoice", options);
|
|
202
|
+
}
|
|
203
|
+
playVoice(options) {
|
|
204
|
+
return this.implement("playVoice", options);
|
|
205
|
+
}
|
|
206
|
+
previewImage(options) {
|
|
207
|
+
return this.implement("previewImage", options);
|
|
208
|
+
}
|
|
209
|
+
scanQRCode(options) {
|
|
210
|
+
return this.implement("scanQRCode", options);
|
|
211
|
+
}
|
|
212
|
+
showAllNonBaseMenuItem() {
|
|
213
|
+
return this.implement("showAllNonBaseMenuItem");
|
|
214
|
+
}
|
|
215
|
+
showMenuItems(options) {
|
|
216
|
+
return this.implement("showMenuItems", options);
|
|
217
|
+
}
|
|
218
|
+
showOptionMenu() {
|
|
219
|
+
return this.implement("showOptionMenu");
|
|
220
|
+
}
|
|
221
|
+
startRecord() {
|
|
222
|
+
return this.implement("startRecord");
|
|
223
|
+
}
|
|
224
|
+
startSearchBeacons(options) {
|
|
225
|
+
return this.implement("startSearchBeacons", options);
|
|
226
|
+
}
|
|
227
|
+
stopRecord(options) {
|
|
228
|
+
return this.implement("stopRecord", options);
|
|
229
|
+
}
|
|
230
|
+
stopSearchBeacons(options) {
|
|
231
|
+
return this.implement("stopSearchBeacons", options);
|
|
232
|
+
}
|
|
233
|
+
stopVoice(options) {
|
|
234
|
+
return this.implement("stopVoice", options);
|
|
235
|
+
}
|
|
236
|
+
translateVoice(options) {
|
|
237
|
+
return this.implement("translateVoice", options);
|
|
238
|
+
}
|
|
239
|
+
uploadImage(options) {
|
|
240
|
+
return this.implement("uploadImage", options);
|
|
241
|
+
}
|
|
242
|
+
uploadVoice(options) {
|
|
243
|
+
return this.implement("uploadVoice", options);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
exports.WechatJssdk = WechatJssdk;
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import * as WxType from 'jweixin';
|
|
2
|
+
|
|
3
|
+
declare module 'jweixin' {
|
|
4
|
+
type v4ApiMethod = 'updateTimelineShareData' | 'updateAppMessageShareData';
|
|
5
|
+
type v4jsApiList = v4ApiMethod[];
|
|
6
|
+
function config(config_: {
|
|
7
|
+
debug?: boolean | undefined;
|
|
8
|
+
appId: string;
|
|
9
|
+
timestamp: number;
|
|
10
|
+
nonceStr: string;
|
|
11
|
+
signature: string;
|
|
12
|
+
jsApiList: WxType.jsApiList & v4jsApiList[];
|
|
13
|
+
}): void;
|
|
14
|
+
}
|
|
15
|
+
declare const wx: typeof WxType;
|
|
16
|
+
declare type WechatJssdkConfig = Omit<Parameters<typeof wx.config>[0], 'catch' | 'finally' | 'then'>;
|
|
17
|
+
interface WechatJssdkOptions {
|
|
18
|
+
/**
|
|
19
|
+
* 初始化请求配置
|
|
20
|
+
*/
|
|
21
|
+
requestConfig: () => Promise<WechatJssdkConfig>;
|
|
22
|
+
/**
|
|
23
|
+
* 是否立即加载 config
|
|
24
|
+
*
|
|
25
|
+
* @default true
|
|
26
|
+
*/
|
|
27
|
+
immediate?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* wechat-jssdk 版本
|
|
30
|
+
*
|
|
31
|
+
* @default 1.3.0
|
|
32
|
+
*/
|
|
33
|
+
version?: '1.2.0' | '1.3.0' | '1.4.0' | '1.5.0' | '1.6.0';
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* jssdk 的前置处理类
|
|
37
|
+
* @constructor 加载配置(apiHost,appId,config,version,jssdk)
|
|
38
|
+
* @function implement 提供 wxApi 执行器(等待 config 与 ready 结束,在调用 api)
|
|
39
|
+
* @function config 加载配置,提供 promise 式返回
|
|
40
|
+
* @function ready wx.rady,提供 promise 式返回
|
|
41
|
+
*/
|
|
42
|
+
declare class WechatJssdkHelper {
|
|
43
|
+
private version;
|
|
44
|
+
private isReady;
|
|
45
|
+
private requestConfig;
|
|
46
|
+
private loadPromise?;
|
|
47
|
+
private configPromise?;
|
|
48
|
+
private readyPromise?;
|
|
49
|
+
private loadJssdk;
|
|
50
|
+
constructor(options: WechatJssdkOptions);
|
|
51
|
+
config(): Promise<void>;
|
|
52
|
+
ready(): Promise<void>;
|
|
53
|
+
error(): Promise<any>;
|
|
54
|
+
protected implement<Key extends keyof typeof wx | string>(key: Key, options?: any): Promise<void>;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @description WechatJssdk Api 封装,与 [jssdk 文档](https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html) 保持一致,主要以下改动
|
|
59
|
+
* @description 内置请求,读取 config 配置,初始化自动调用 wx.config
|
|
60
|
+
* @description 所有 api 的 promise 化处理(仅等待 wx.ready)
|
|
61
|
+
* @description 简易化初始化构建,config 处理
|
|
62
|
+
* @description 可指定加载 jssdk 版本(默认 1.3.0)
|
|
63
|
+
* @template `const wxJssdk = new WechatJssdk({env, config})`
|
|
64
|
+
*/
|
|
65
|
+
declare class WechatJssdk extends WechatJssdkHelper {
|
|
66
|
+
constructor(options: WechatJssdkOptions);
|
|
67
|
+
updateAppMessageShareData(options: WxType.IonMenuShareAppMessage): Promise<void>;
|
|
68
|
+
updateTimelineShareData(options: WxType.IonMenuShareAppMessage): Promise<void>;
|
|
69
|
+
addCard(): Promise<void>;
|
|
70
|
+
checkJsApi(options: WxType.IcheckJsApi): Promise<void>;
|
|
71
|
+
chooseCard(options: WxType.IchooseCard): Promise<void>;
|
|
72
|
+
chooseImage(options: WxType.IchooseImage): Promise<void>;
|
|
73
|
+
chooseWXPay(options: WxType.IchooseWXPay): Promise<void>;
|
|
74
|
+
closeWindow(): Promise<void>;
|
|
75
|
+
consumeAndShareCard(options: WxType.IconsumeAndShareCard): Promise<void>;
|
|
76
|
+
downloadImage(options: WxType.IdownloadImage): Promise<void>;
|
|
77
|
+
downloadVoice(options: WxType.IupdownloadVoice): Promise<void>;
|
|
78
|
+
getLocalImgData(options: WxType.IgetLocalImgData): Promise<void>;
|
|
79
|
+
getLocation(options: WxType.IgetLocation): Promise<void>;
|
|
80
|
+
getNetworkType(options: WxType.IgetNetworkType): Promise<void>;
|
|
81
|
+
hideAllNonBaseMenuItem(): Promise<void>;
|
|
82
|
+
hideMenuItems(options: WxType.IhideMenuItems): Promise<void>;
|
|
83
|
+
hideOptionMenu(): Promise<void>;
|
|
84
|
+
onMenuShareAppMessage(options: WxType.IonMenuShareAppMessage): Promise<void>;
|
|
85
|
+
onMenuShareQQ(options: WxType.IonMenuShareQQ): Promise<void>;
|
|
86
|
+
onMenuShareQZone(options: WxType.IonMenuShareQZone): Promise<void>;
|
|
87
|
+
onMenuShareTimeline(options: WxType.IonMenuShareTimeline): Promise<void>;
|
|
88
|
+
onMenuShareWeibo(options: WxType.IonMenuShareWeibo): Promise<void>;
|
|
89
|
+
onSearchBeacons(options: WxType.IonSearchBeacons): Promise<void>;
|
|
90
|
+
onVoicePlayEnd(options: WxType.IonVoicePlayEnd): Promise<void>;
|
|
91
|
+
onVoiceRecordEnd(options: WxType.IonVoiceRecordEnd): Promise<void>;
|
|
92
|
+
openCard(options: WxType.IopenCard): Promise<void>;
|
|
93
|
+
openLocation(options: WxType.IopenLocation): Promise<void>;
|
|
94
|
+
openProductSpecificView(options: WxType.IopenProductSpecificView): Promise<void>;
|
|
95
|
+
pauseVoice(options: WxType.IplaypausestopVoice): Promise<void>;
|
|
96
|
+
playVoice(options: WxType.IplaypausestopVoice): Promise<void>;
|
|
97
|
+
previewImage(options: WxType.IpreviewImage): Promise<void>;
|
|
98
|
+
scanQRCode(options: WxType.IscanQRCode): Promise<void>;
|
|
99
|
+
showAllNonBaseMenuItem(): Promise<void>;
|
|
100
|
+
showMenuItems(options: WxType.IshowMenuItems): Promise<void>;
|
|
101
|
+
showOptionMenu(): Promise<void>;
|
|
102
|
+
startRecord(): Promise<void>;
|
|
103
|
+
startSearchBeacons(options: WxType.IstartSearchBeacons): Promise<void>;
|
|
104
|
+
stopRecord(options: WxType.IstopRecord): Promise<void>;
|
|
105
|
+
stopSearchBeacons(options: WxType.IstopSearchBeacons): Promise<void>;
|
|
106
|
+
stopVoice(options: WxType.IplaypausestopVoice): Promise<void>;
|
|
107
|
+
translateVoice(options: WxType.ItranslateVoice): Promise<void>;
|
|
108
|
+
uploadImage(options: WxType.IuploadImage): Promise<void>;
|
|
109
|
+
uploadVoice(options: WxType.IupdownloadVoice): Promise<void>;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export { WechatJssdk };
|
package/index.esm.js
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import { noop } from '@hairy/core';
|
|
2
|
+
|
|
3
|
+
const loadScript = (source, onLoaded = noop, options = {}) => {
|
|
4
|
+
const {
|
|
5
|
+
type = "text/javascript",
|
|
6
|
+
async = true,
|
|
7
|
+
crossOrigin,
|
|
8
|
+
referrerPolicy,
|
|
9
|
+
noModule,
|
|
10
|
+
defer,
|
|
11
|
+
waitForScriptLoad = true
|
|
12
|
+
} = options;
|
|
13
|
+
return new Promise((resolve, reject) => {
|
|
14
|
+
let shouldAppend = false;
|
|
15
|
+
let element = document.querySelector(`script[src="${source}"]`);
|
|
16
|
+
if (!element) {
|
|
17
|
+
element = document.createElement("script");
|
|
18
|
+
element.type = type;
|
|
19
|
+
element.async = async;
|
|
20
|
+
element.src = source;
|
|
21
|
+
if (defer)
|
|
22
|
+
element.defer = defer;
|
|
23
|
+
if (crossOrigin)
|
|
24
|
+
element.crossOrigin = crossOrigin;
|
|
25
|
+
if (noModule)
|
|
26
|
+
element.noModule = noModule;
|
|
27
|
+
if (referrerPolicy)
|
|
28
|
+
element.referrerPolicy = referrerPolicy;
|
|
29
|
+
shouldAppend = true;
|
|
30
|
+
} else if (element.hasAttribute("data-loaded")) {
|
|
31
|
+
resolve(element);
|
|
32
|
+
}
|
|
33
|
+
element.addEventListener("error", (event) => reject(event));
|
|
34
|
+
element.addEventListener("abort", (event) => reject(event));
|
|
35
|
+
element.addEventListener("load", () => {
|
|
36
|
+
element.dataset.loaded = "true";
|
|
37
|
+
onLoaded(element);
|
|
38
|
+
resolve(element);
|
|
39
|
+
});
|
|
40
|
+
if (shouldAppend) {
|
|
41
|
+
element = document.head.appendChild(element);
|
|
42
|
+
}
|
|
43
|
+
if (!waitForScriptLoad) {
|
|
44
|
+
resolve(element);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
class WechatJssdkHelper {
|
|
50
|
+
constructor(options) {
|
|
51
|
+
this.isReady = false;
|
|
52
|
+
const { immediate = true, version, requestConfig } = options;
|
|
53
|
+
this.version = version || "1.3.0";
|
|
54
|
+
this.requestConfig = requestConfig;
|
|
55
|
+
this.loadJssdk();
|
|
56
|
+
if (immediate)
|
|
57
|
+
this.config();
|
|
58
|
+
}
|
|
59
|
+
loadJssdk() {
|
|
60
|
+
const scriptUrl = `https://res.wx.qq.com/open/js/jweixin-${this.version}.js`;
|
|
61
|
+
this.loadPromise = loadScript(scriptUrl).then(() => {
|
|
62
|
+
this.loadPromise = void 0;
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
async config() {
|
|
66
|
+
if (this.configPromise)
|
|
67
|
+
return this.configPromise;
|
|
68
|
+
if (this.loadPromise)
|
|
69
|
+
await this.loadPromise;
|
|
70
|
+
this.configPromise = (async () => {
|
|
71
|
+
wx.config(await this.requestConfig());
|
|
72
|
+
})();
|
|
73
|
+
return this.configPromise;
|
|
74
|
+
}
|
|
75
|
+
async ready() {
|
|
76
|
+
if (this.readyPromise)
|
|
77
|
+
return this.readyPromise;
|
|
78
|
+
if (this.loadPromise)
|
|
79
|
+
await this.loadPromise;
|
|
80
|
+
if (this.isReady)
|
|
81
|
+
return;
|
|
82
|
+
this.readyPromise = new Promise((resolve, reject) => {
|
|
83
|
+
wx.ready(() => {
|
|
84
|
+
this.isReady = true;
|
|
85
|
+
this.readyPromise = void 0;
|
|
86
|
+
resolve();
|
|
87
|
+
});
|
|
88
|
+
wx.error((error) => {
|
|
89
|
+
this.isReady = false;
|
|
90
|
+
this.readyPromise = void 0;
|
|
91
|
+
reject(error);
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
return this.readyPromise;
|
|
95
|
+
}
|
|
96
|
+
async error() {
|
|
97
|
+
return this.ready().catch((error) => error);
|
|
98
|
+
}
|
|
99
|
+
async implement(key, options) {
|
|
100
|
+
if (this.configPromise) {
|
|
101
|
+
await this.configPromise;
|
|
102
|
+
}
|
|
103
|
+
await this.ready();
|
|
104
|
+
wx[key](options);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
class WechatJssdk extends WechatJssdkHelper {
|
|
109
|
+
constructor(options) {
|
|
110
|
+
super(options);
|
|
111
|
+
}
|
|
112
|
+
updateAppMessageShareData(options) {
|
|
113
|
+
return this.implement("updateAppMessageShareData", options);
|
|
114
|
+
}
|
|
115
|
+
updateTimelineShareData(options) {
|
|
116
|
+
return this.implement("updateTimelineShareData", options);
|
|
117
|
+
}
|
|
118
|
+
addCard() {
|
|
119
|
+
return this.implement("addCard");
|
|
120
|
+
}
|
|
121
|
+
checkJsApi(options) {
|
|
122
|
+
return this.implement("checkJsApi", options);
|
|
123
|
+
}
|
|
124
|
+
chooseCard(options) {
|
|
125
|
+
return this.implement("chooseCard", options);
|
|
126
|
+
}
|
|
127
|
+
chooseImage(options) {
|
|
128
|
+
return this.implement("chooseImage", options);
|
|
129
|
+
}
|
|
130
|
+
chooseWXPay(options) {
|
|
131
|
+
return this.implement("chooseWXPay", options);
|
|
132
|
+
}
|
|
133
|
+
closeWindow() {
|
|
134
|
+
return this.implement("closeWindow");
|
|
135
|
+
}
|
|
136
|
+
consumeAndShareCard(options) {
|
|
137
|
+
return this.implement("consumeAndShareCard", options);
|
|
138
|
+
}
|
|
139
|
+
downloadImage(options) {
|
|
140
|
+
return this.implement("downloadImage", options);
|
|
141
|
+
}
|
|
142
|
+
downloadVoice(options) {
|
|
143
|
+
return this.implement("downloadVoice", options);
|
|
144
|
+
}
|
|
145
|
+
getLocalImgData(options) {
|
|
146
|
+
return this.implement("getLocalImgData", options);
|
|
147
|
+
}
|
|
148
|
+
getLocation(options) {
|
|
149
|
+
return this.implement("getLocation", options);
|
|
150
|
+
}
|
|
151
|
+
getNetworkType(options) {
|
|
152
|
+
return this.implement("getNetworkType", options);
|
|
153
|
+
}
|
|
154
|
+
hideAllNonBaseMenuItem() {
|
|
155
|
+
return this.implement("hideAllNonBaseMenuItem");
|
|
156
|
+
}
|
|
157
|
+
hideMenuItems(options) {
|
|
158
|
+
return this.implement("hideMenuItems", options);
|
|
159
|
+
}
|
|
160
|
+
hideOptionMenu() {
|
|
161
|
+
return this.implement("hideOptionMenu");
|
|
162
|
+
}
|
|
163
|
+
onMenuShareAppMessage(options) {
|
|
164
|
+
return this.implement("onMenuShareAppMessage", options);
|
|
165
|
+
}
|
|
166
|
+
onMenuShareQQ(options) {
|
|
167
|
+
return this.implement("onMenuShareQQ", options);
|
|
168
|
+
}
|
|
169
|
+
onMenuShareQZone(options) {
|
|
170
|
+
return this.implement("onMenuShareQZone", options);
|
|
171
|
+
}
|
|
172
|
+
onMenuShareTimeline(options) {
|
|
173
|
+
return this.implement("onMenuShareTimeline", options);
|
|
174
|
+
}
|
|
175
|
+
onMenuShareWeibo(options) {
|
|
176
|
+
return this.implement("onMenuShareWeibo", options);
|
|
177
|
+
}
|
|
178
|
+
onSearchBeacons(options) {
|
|
179
|
+
return this.implement("onSearchBeacons", options);
|
|
180
|
+
}
|
|
181
|
+
onVoicePlayEnd(options) {
|
|
182
|
+
return this.implement("onVoicePlayEnd", options);
|
|
183
|
+
}
|
|
184
|
+
onVoiceRecordEnd(options) {
|
|
185
|
+
return this.implement("onVoiceRecordEnd", options);
|
|
186
|
+
}
|
|
187
|
+
openCard(options) {
|
|
188
|
+
return this.implement("openCard", options);
|
|
189
|
+
}
|
|
190
|
+
openLocation(options) {
|
|
191
|
+
return this.implement("openLocation", options);
|
|
192
|
+
}
|
|
193
|
+
openProductSpecificView(options) {
|
|
194
|
+
return this.implement("openProductSpecificView", options);
|
|
195
|
+
}
|
|
196
|
+
pauseVoice(options) {
|
|
197
|
+
return this.implement("pauseVoice", options);
|
|
198
|
+
}
|
|
199
|
+
playVoice(options) {
|
|
200
|
+
return this.implement("playVoice", options);
|
|
201
|
+
}
|
|
202
|
+
previewImage(options) {
|
|
203
|
+
return this.implement("previewImage", options);
|
|
204
|
+
}
|
|
205
|
+
scanQRCode(options) {
|
|
206
|
+
return this.implement("scanQRCode", options);
|
|
207
|
+
}
|
|
208
|
+
showAllNonBaseMenuItem() {
|
|
209
|
+
return this.implement("showAllNonBaseMenuItem");
|
|
210
|
+
}
|
|
211
|
+
showMenuItems(options) {
|
|
212
|
+
return this.implement("showMenuItems", options);
|
|
213
|
+
}
|
|
214
|
+
showOptionMenu() {
|
|
215
|
+
return this.implement("showOptionMenu");
|
|
216
|
+
}
|
|
217
|
+
startRecord() {
|
|
218
|
+
return this.implement("startRecord");
|
|
219
|
+
}
|
|
220
|
+
startSearchBeacons(options) {
|
|
221
|
+
return this.implement("startSearchBeacons", options);
|
|
222
|
+
}
|
|
223
|
+
stopRecord(options) {
|
|
224
|
+
return this.implement("stopRecord", options);
|
|
225
|
+
}
|
|
226
|
+
stopSearchBeacons(options) {
|
|
227
|
+
return this.implement("stopSearchBeacons", options);
|
|
228
|
+
}
|
|
229
|
+
stopVoice(options) {
|
|
230
|
+
return this.implement("stopVoice", options);
|
|
231
|
+
}
|
|
232
|
+
translateVoice(options) {
|
|
233
|
+
return this.implement("translateVoice", options);
|
|
234
|
+
}
|
|
235
|
+
uploadImage(options) {
|
|
236
|
+
return this.implement("uploadImage", options);
|
|
237
|
+
}
|
|
238
|
+
uploadVoice(options) {
|
|
239
|
+
return this.implement("uploadVoice", options);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export { WechatJssdk };
|
package/index.iife.js
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
(function (exports, core) {
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const loadScript = (source, onLoaded = core.noop, options = {}) => {
|
|
5
|
+
const {
|
|
6
|
+
type = "text/javascript",
|
|
7
|
+
async = true,
|
|
8
|
+
crossOrigin,
|
|
9
|
+
referrerPolicy,
|
|
10
|
+
noModule,
|
|
11
|
+
defer,
|
|
12
|
+
waitForScriptLoad = true
|
|
13
|
+
} = options;
|
|
14
|
+
return new Promise((resolve, reject) => {
|
|
15
|
+
let shouldAppend = false;
|
|
16
|
+
let element = document.querySelector(`script[src="${source}"]`);
|
|
17
|
+
if (!element) {
|
|
18
|
+
element = document.createElement("script");
|
|
19
|
+
element.type = type;
|
|
20
|
+
element.async = async;
|
|
21
|
+
element.src = source;
|
|
22
|
+
if (defer)
|
|
23
|
+
element.defer = defer;
|
|
24
|
+
if (crossOrigin)
|
|
25
|
+
element.crossOrigin = crossOrigin;
|
|
26
|
+
if (noModule)
|
|
27
|
+
element.noModule = noModule;
|
|
28
|
+
if (referrerPolicy)
|
|
29
|
+
element.referrerPolicy = referrerPolicy;
|
|
30
|
+
shouldAppend = true;
|
|
31
|
+
} else if (element.hasAttribute("data-loaded")) {
|
|
32
|
+
resolve(element);
|
|
33
|
+
}
|
|
34
|
+
element.addEventListener("error", (event) => reject(event));
|
|
35
|
+
element.addEventListener("abort", (event) => reject(event));
|
|
36
|
+
element.addEventListener("load", () => {
|
|
37
|
+
element.dataset.loaded = "true";
|
|
38
|
+
onLoaded(element);
|
|
39
|
+
resolve(element);
|
|
40
|
+
});
|
|
41
|
+
if (shouldAppend) {
|
|
42
|
+
element = document.head.appendChild(element);
|
|
43
|
+
}
|
|
44
|
+
if (!waitForScriptLoad) {
|
|
45
|
+
resolve(element);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
class WechatJssdkHelper {
|
|
51
|
+
constructor(options) {
|
|
52
|
+
this.isReady = false;
|
|
53
|
+
const { immediate = true, version, requestConfig } = options;
|
|
54
|
+
this.version = version || "1.3.0";
|
|
55
|
+
this.requestConfig = requestConfig;
|
|
56
|
+
this.loadJssdk();
|
|
57
|
+
if (immediate)
|
|
58
|
+
this.config();
|
|
59
|
+
}
|
|
60
|
+
loadJssdk() {
|
|
61
|
+
const scriptUrl = `https://res.wx.qq.com/open/js/jweixin-${this.version}.js`;
|
|
62
|
+
this.loadPromise = loadScript(scriptUrl).then(() => {
|
|
63
|
+
this.loadPromise = void 0;
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
async config() {
|
|
67
|
+
if (this.configPromise)
|
|
68
|
+
return this.configPromise;
|
|
69
|
+
if (this.loadPromise)
|
|
70
|
+
await this.loadPromise;
|
|
71
|
+
this.configPromise = (async () => {
|
|
72
|
+
wx.config(await this.requestConfig());
|
|
73
|
+
})();
|
|
74
|
+
return this.configPromise;
|
|
75
|
+
}
|
|
76
|
+
async ready() {
|
|
77
|
+
if (this.readyPromise)
|
|
78
|
+
return this.readyPromise;
|
|
79
|
+
if (this.loadPromise)
|
|
80
|
+
await this.loadPromise;
|
|
81
|
+
if (this.isReady)
|
|
82
|
+
return;
|
|
83
|
+
this.readyPromise = new Promise((resolve, reject) => {
|
|
84
|
+
wx.ready(() => {
|
|
85
|
+
this.isReady = true;
|
|
86
|
+
this.readyPromise = void 0;
|
|
87
|
+
resolve();
|
|
88
|
+
});
|
|
89
|
+
wx.error((error) => {
|
|
90
|
+
this.isReady = false;
|
|
91
|
+
this.readyPromise = void 0;
|
|
92
|
+
reject(error);
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
return this.readyPromise;
|
|
96
|
+
}
|
|
97
|
+
async error() {
|
|
98
|
+
return this.ready().catch((error) => error);
|
|
99
|
+
}
|
|
100
|
+
async implement(key, options) {
|
|
101
|
+
if (this.configPromise) {
|
|
102
|
+
await this.configPromise;
|
|
103
|
+
}
|
|
104
|
+
await this.ready();
|
|
105
|
+
wx[key](options);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
class WechatJssdk extends WechatJssdkHelper {
|
|
110
|
+
constructor(options) {
|
|
111
|
+
super(options);
|
|
112
|
+
}
|
|
113
|
+
updateAppMessageShareData(options) {
|
|
114
|
+
return this.implement("updateAppMessageShareData", options);
|
|
115
|
+
}
|
|
116
|
+
updateTimelineShareData(options) {
|
|
117
|
+
return this.implement("updateTimelineShareData", options);
|
|
118
|
+
}
|
|
119
|
+
addCard() {
|
|
120
|
+
return this.implement("addCard");
|
|
121
|
+
}
|
|
122
|
+
checkJsApi(options) {
|
|
123
|
+
return this.implement("checkJsApi", options);
|
|
124
|
+
}
|
|
125
|
+
chooseCard(options) {
|
|
126
|
+
return this.implement("chooseCard", options);
|
|
127
|
+
}
|
|
128
|
+
chooseImage(options) {
|
|
129
|
+
return this.implement("chooseImage", options);
|
|
130
|
+
}
|
|
131
|
+
chooseWXPay(options) {
|
|
132
|
+
return this.implement("chooseWXPay", options);
|
|
133
|
+
}
|
|
134
|
+
closeWindow() {
|
|
135
|
+
return this.implement("closeWindow");
|
|
136
|
+
}
|
|
137
|
+
consumeAndShareCard(options) {
|
|
138
|
+
return this.implement("consumeAndShareCard", options);
|
|
139
|
+
}
|
|
140
|
+
downloadImage(options) {
|
|
141
|
+
return this.implement("downloadImage", options);
|
|
142
|
+
}
|
|
143
|
+
downloadVoice(options) {
|
|
144
|
+
return this.implement("downloadVoice", options);
|
|
145
|
+
}
|
|
146
|
+
getLocalImgData(options) {
|
|
147
|
+
return this.implement("getLocalImgData", options);
|
|
148
|
+
}
|
|
149
|
+
getLocation(options) {
|
|
150
|
+
return this.implement("getLocation", options);
|
|
151
|
+
}
|
|
152
|
+
getNetworkType(options) {
|
|
153
|
+
return this.implement("getNetworkType", options);
|
|
154
|
+
}
|
|
155
|
+
hideAllNonBaseMenuItem() {
|
|
156
|
+
return this.implement("hideAllNonBaseMenuItem");
|
|
157
|
+
}
|
|
158
|
+
hideMenuItems(options) {
|
|
159
|
+
return this.implement("hideMenuItems", options);
|
|
160
|
+
}
|
|
161
|
+
hideOptionMenu() {
|
|
162
|
+
return this.implement("hideOptionMenu");
|
|
163
|
+
}
|
|
164
|
+
onMenuShareAppMessage(options) {
|
|
165
|
+
return this.implement("onMenuShareAppMessage", options);
|
|
166
|
+
}
|
|
167
|
+
onMenuShareQQ(options) {
|
|
168
|
+
return this.implement("onMenuShareQQ", options);
|
|
169
|
+
}
|
|
170
|
+
onMenuShareQZone(options) {
|
|
171
|
+
return this.implement("onMenuShareQZone", options);
|
|
172
|
+
}
|
|
173
|
+
onMenuShareTimeline(options) {
|
|
174
|
+
return this.implement("onMenuShareTimeline", options);
|
|
175
|
+
}
|
|
176
|
+
onMenuShareWeibo(options) {
|
|
177
|
+
return this.implement("onMenuShareWeibo", options);
|
|
178
|
+
}
|
|
179
|
+
onSearchBeacons(options) {
|
|
180
|
+
return this.implement("onSearchBeacons", options);
|
|
181
|
+
}
|
|
182
|
+
onVoicePlayEnd(options) {
|
|
183
|
+
return this.implement("onVoicePlayEnd", options);
|
|
184
|
+
}
|
|
185
|
+
onVoiceRecordEnd(options) {
|
|
186
|
+
return this.implement("onVoiceRecordEnd", options);
|
|
187
|
+
}
|
|
188
|
+
openCard(options) {
|
|
189
|
+
return this.implement("openCard", options);
|
|
190
|
+
}
|
|
191
|
+
openLocation(options) {
|
|
192
|
+
return this.implement("openLocation", options);
|
|
193
|
+
}
|
|
194
|
+
openProductSpecificView(options) {
|
|
195
|
+
return this.implement("openProductSpecificView", options);
|
|
196
|
+
}
|
|
197
|
+
pauseVoice(options) {
|
|
198
|
+
return this.implement("pauseVoice", options);
|
|
199
|
+
}
|
|
200
|
+
playVoice(options) {
|
|
201
|
+
return this.implement("playVoice", options);
|
|
202
|
+
}
|
|
203
|
+
previewImage(options) {
|
|
204
|
+
return this.implement("previewImage", options);
|
|
205
|
+
}
|
|
206
|
+
scanQRCode(options) {
|
|
207
|
+
return this.implement("scanQRCode", options);
|
|
208
|
+
}
|
|
209
|
+
showAllNonBaseMenuItem() {
|
|
210
|
+
return this.implement("showAllNonBaseMenuItem");
|
|
211
|
+
}
|
|
212
|
+
showMenuItems(options) {
|
|
213
|
+
return this.implement("showMenuItems", options);
|
|
214
|
+
}
|
|
215
|
+
showOptionMenu() {
|
|
216
|
+
return this.implement("showOptionMenu");
|
|
217
|
+
}
|
|
218
|
+
startRecord() {
|
|
219
|
+
return this.implement("startRecord");
|
|
220
|
+
}
|
|
221
|
+
startSearchBeacons(options) {
|
|
222
|
+
return this.implement("startSearchBeacons", options);
|
|
223
|
+
}
|
|
224
|
+
stopRecord(options) {
|
|
225
|
+
return this.implement("stopRecord", options);
|
|
226
|
+
}
|
|
227
|
+
stopSearchBeacons(options) {
|
|
228
|
+
return this.implement("stopSearchBeacons", options);
|
|
229
|
+
}
|
|
230
|
+
stopVoice(options) {
|
|
231
|
+
return this.implement("stopVoice", options);
|
|
232
|
+
}
|
|
233
|
+
translateVoice(options) {
|
|
234
|
+
return this.implement("translateVoice", options);
|
|
235
|
+
}
|
|
236
|
+
uploadImage(options) {
|
|
237
|
+
return this.implement("uploadImage", options);
|
|
238
|
+
}
|
|
239
|
+
uploadVoice(options) {
|
|
240
|
+
return this.implement("uploadVoice", options);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
exports.WechatJssdk = WechatJssdk;
|
|
245
|
+
|
|
246
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
247
|
+
|
|
248
|
+
})(this.TuiMaoUtils = this.TuiMaoUtils || {}, TuiMaoCore);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,t){"use strict";e.WechatJssdk=class extends class{constructor(e){this.isReady=!1;const{immediate:t=!0,version:i,requestConfig:n}=e;this.version=i||"1.3.0",this.requestConfig=n,this.loadJssdk(),t&&this.config()}loadJssdk(){const e=`https://res.wx.qq.com/open/js/jweixin-${this.version}.js`;this.loadPromise=((e,i=t.noop,n={})=>{const{type:r="text/javascript",async:s=!0,crossOrigin:o,referrerPolicy:a,noModule:m,defer:h,waitForScriptLoad:d=!0}=n;return new Promise(((t,n)=>{let c=!1,u=document.querySelector(`script[src="${e}"]`);u?u.hasAttribute("data-loaded")&&t(u):(u=document.createElement("script"),u.type=r,u.async=s,u.src=e,h&&(u.defer=h),o&&(u.crossOrigin=o),m&&(u.noModule=m),a&&(u.referrerPolicy=a),c=!0),u.addEventListener("error",(e=>n(e))),u.addEventListener("abort",(e=>n(e))),u.addEventListener("load",(()=>{u.dataset.loaded="true",i(u),t(u)})),c&&(u=document.head.appendChild(u)),d||t(u)}))})(e).then((()=>{this.loadPromise=void 0}))}async config(){return this.configPromise||(this.loadPromise&&await this.loadPromise,this.configPromise=(async()=>{wx.config(await this.requestConfig())})()),this.configPromise}async ready(){return this.readyPromise?this.readyPromise:(this.loadPromise&&await this.loadPromise,this.isReady?void 0:(this.readyPromise=new Promise(((e,t)=>{wx.ready((()=>{this.isReady=!0,this.readyPromise=void 0,e()})),wx.error((e=>{this.isReady=!1,this.readyPromise=void 0,t(e)}))})),this.readyPromise))}async error(){return this.ready().catch((e=>e))}async implement(e,t){this.configPromise&&await this.configPromise,await this.ready(),wx[e](t)}}{constructor(e){super(e)}updateAppMessageShareData(e){return this.implement("updateAppMessageShareData",e)}updateTimelineShareData(e){return this.implement("updateTimelineShareData",e)}addCard(){return this.implement("addCard")}checkJsApi(e){return this.implement("checkJsApi",e)}chooseCard(e){return this.implement("chooseCard",e)}chooseImage(e){return this.implement("chooseImage",e)}chooseWXPay(e){return this.implement("chooseWXPay",e)}closeWindow(){return this.implement("closeWindow")}consumeAndShareCard(e){return this.implement("consumeAndShareCard",e)}downloadImage(e){return this.implement("downloadImage",e)}downloadVoice(e){return this.implement("downloadVoice",e)}getLocalImgData(e){return this.implement("getLocalImgData",e)}getLocation(e){return this.implement("getLocation",e)}getNetworkType(e){return this.implement("getNetworkType",e)}hideAllNonBaseMenuItem(){return this.implement("hideAllNonBaseMenuItem")}hideMenuItems(e){return this.implement("hideMenuItems",e)}hideOptionMenu(){return this.implement("hideOptionMenu")}onMenuShareAppMessage(e){return this.implement("onMenuShareAppMessage",e)}onMenuShareQQ(e){return this.implement("onMenuShareQQ",e)}onMenuShareQZone(e){return this.implement("onMenuShareQZone",e)}onMenuShareTimeline(e){return this.implement("onMenuShareTimeline",e)}onMenuShareWeibo(e){return this.implement("onMenuShareWeibo",e)}onSearchBeacons(e){return this.implement("onSearchBeacons",e)}onVoicePlayEnd(e){return this.implement("onVoicePlayEnd",e)}onVoiceRecordEnd(e){return this.implement("onVoiceRecordEnd",e)}openCard(e){return this.implement("openCard",e)}openLocation(e){return this.implement("openLocation",e)}openProductSpecificView(e){return this.implement("openProductSpecificView",e)}pauseVoice(e){return this.implement("pauseVoice",e)}playVoice(e){return this.implement("playVoice",e)}previewImage(e){return this.implement("previewImage",e)}scanQRCode(e){return this.implement("scanQRCode",e)}showAllNonBaseMenuItem(){return this.implement("showAllNonBaseMenuItem")}showMenuItems(e){return this.implement("showMenuItems",e)}showOptionMenu(){return this.implement("showOptionMenu")}startRecord(){return this.implement("startRecord")}startSearchBeacons(e){return this.implement("startSearchBeacons",e)}stopRecord(e){return this.implement("stopRecord",e)}stopSearchBeacons(e){return this.implement("stopSearchBeacons",e)}stopVoice(e){return this.implement("stopVoice",e)}translateVoice(e){return this.implement("translateVoice",e)}uploadImage(e){return this.implement("uploadImage",e)}uploadVoice(e){return this.implement("uploadVoice",e)}},Object.defineProperty(e,"__esModule",{value:!0})}(this.TuiMaoUtils=this.TuiMaoUtils||{},TuiMaoCore);
|
package/package.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hairy/wechat-jssdk",
|
|
3
|
+
"version": "1.0.3",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"@types/jweixin": "^1.0.8",
|
|
7
|
+
"jweixin": "^1.0.0"
|
|
8
|
+
},
|
|
9
|
+
"main": "./index.cjs.js",
|
|
10
|
+
"types": "./index.d.ts",
|
|
11
|
+
"module": "./index.esm.js",
|
|
12
|
+
"unpkg": "./index.iife.min.js",
|
|
13
|
+
"jsdelivr": "./index.iife.min.js",
|
|
14
|
+
"author": "Anthony Fu<https://github.com/TuiMao233>",
|
|
15
|
+
"gitHead": "d5b83d069dd7dfcd65aa6bcd07f1a33baceff00d"
|
|
16
|
+
}
|