@hairy/wechat-jssdk 1.0.6 → 1.0.7
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/index.cjs.js +2 -2
- package/index.esm.js +1 -1
- package/index.iife.js +3 -3
- package/index.iife.min.js +1 -1
- package/package.json +21 -2
- package/README.md +0 -0
package/index.cjs.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var utils = require('@hairy/utils');
|
|
6
6
|
|
|
7
|
-
const loadScript = (source, onLoaded =
|
|
7
|
+
const loadScript = (source, onLoaded = utils.noop, options = {}) => {
|
|
8
8
|
const {
|
|
9
9
|
type = "text/javascript",
|
|
10
10
|
async = true,
|
package/index.esm.js
CHANGED
package/index.iife.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
(function (exports,
|
|
1
|
+
(function (exports, utils) {
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
const loadScript = (source, onLoaded =
|
|
4
|
+
const loadScript = (source, onLoaded = utils.noop, options = {}) => {
|
|
5
5
|
const {
|
|
6
6
|
type = "text/javascript",
|
|
7
7
|
async = true,
|
|
@@ -245,4 +245,4 @@
|
|
|
245
245
|
|
|
246
246
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
247
247
|
|
|
248
|
-
})(this.
|
|
248
|
+
})(this.hairyWechatJssdk = this.hairyWechatJssdk || {}, hairyUtils);
|
package/index.iife.min.js
CHANGED
|
@@ -1 +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,
|
|
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,p=document.querySelector(`script[src="${e}"]`);p?p.hasAttribute("data-loaded")&&t(p):(p=document.createElement("script"),p.type=r,p.async=s,p.src=e,h&&(p.defer=h),o&&(p.crossOrigin=o),m&&(p.noModule=m),a&&(p.referrerPolicy=a),c=!0),p.addEventListener("error",(e=>n(e))),p.addEventListener("abort",(e=>n(e))),p.addEventListener("load",(()=>{p.dataset.loaded="true",i(p),t(p)})),c&&(p=document.head.appendChild(p)),d||t(p)}))})(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.hairyWechatJssdk=this.hairyWechatJssdk||{},hairyUtils);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hairy/wechat-jssdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@types/jweixin": "^1.0.8",
|
|
@@ -12,5 +12,24 @@
|
|
|
12
12
|
"unpkg": "./index.iife.min.js",
|
|
13
13
|
"jsdelivr": "./index.iife.min.js",
|
|
14
14
|
"author": "Anthony Fu<https://github.com/TuiMao233>",
|
|
15
|
-
"gitHead": "
|
|
15
|
+
"gitHead": "8fbecb4d66553d61eed585bcbf63ffb1d14ce900",
|
|
16
|
+
"description": "Wechat Jssdk",
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/TuiMao233/hairylib/issues"
|
|
19
|
+
},
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/TuiMao233/hairylib.git"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://github.com/TuiMao233/hairylib#readme",
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"import": "./index.esm.js",
|
|
28
|
+
"require": "./index.cjs.js"
|
|
29
|
+
},
|
|
30
|
+
"./*": "./*"
|
|
31
|
+
},
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
}
|
|
16
35
|
}
|
package/README.md
DELETED
|
File without changes
|