@dcloudio/uni-quickapp-webview 2.0.0-alpha-32720210917004 → 2.0.0-alpha-32920210930002

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/dist/index.js CHANGED
@@ -1,8 +1,36 @@
1
1
  import Vue from 'vue';
2
2
  import { initVueI18n } from '@dcloudio/uni-i18n';
3
3
 
4
+ let realAtob;
5
+
6
+ const b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
7
+ const b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;
8
+
9
+ if (typeof atob !== 'function') {
10
+ realAtob = function (str) {
11
+ str = String(str).replace(/[\t\n\f\r ]+/g, '');
12
+ if (!b64re.test(str)) { throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.") }
13
+
14
+ // Adding the padding if missing, for semplicity
15
+ str += '=='.slice(2 - (str.length & 3));
16
+ var bitmap; var result = ''; var r1; var r2; var i = 0;
17
+ for (; i < str.length;) {
18
+ bitmap = b64.indexOf(str.charAt(i++)) << 18 | b64.indexOf(str.charAt(i++)) << 12 |
19
+ (r1 = b64.indexOf(str.charAt(i++))) << 6 | (r2 = b64.indexOf(str.charAt(i++)));
20
+
21
+ result += r1 === 64 ? String.fromCharCode(bitmap >> 16 & 255)
22
+ : r2 === 64 ? String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255)
23
+ : String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255, bitmap & 255);
24
+ }
25
+ return result
26
+ };
27
+ } else {
28
+ // 注意atob只能在全局对象上调用,例如:`const Base64 = {atob};Base64.atob('xxxx')`是错误的用法
29
+ realAtob = atob;
30
+ }
31
+
4
32
  function b64DecodeUnicode (str) {
5
- return decodeURIComponent(atob(str).split('').map(function (c) {
33
+ return decodeURIComponent(realAtob(str).split('').map(function (c) {
6
34
  return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2)
7
35
  }).join(''))
8
36
  }
@@ -431,6 +459,10 @@ function onLocaleChange (fn) {
431
459
  if (onLocaleChangeCallbacks.indexOf(fn) === -1) {
432
460
  onLocaleChangeCallbacks.push(fn);
433
461
  }
462
+ }
463
+
464
+ if (typeof global !== 'undefined') {
465
+ global.getLocale = getLocale;
434
466
  }
435
467
 
436
468
  const interceptors = {
@@ -473,7 +473,8 @@ const removeInterceptor = defineSyncApi(API_REMOVE_INTERCEPTOR, (method, interce
473
473
  else if (isPlainObject(method)) {
474
474
  removeInterceptorHook(globalInterceptors, method);
475
475
  }
476
- }, RemoveInterceptorProtocol);
476
+ }, RemoveInterceptorProtocol);
477
+ const interceptors = {};
477
478
 
478
479
  const API_ON = '$on';
479
480
  const OnProtocol = [
@@ -753,7 +754,10 @@ const onLocaleChange = (fn) => {
753
754
  if (onLocaleChangeCallbacks.indexOf(fn) === -1) {
754
755
  onLocaleChangeCallbacks.push(fn);
755
756
  }
756
- };
757
+ };
758
+ if (typeof global !== 'undefined') {
759
+ global.getLocale = getLocale;
760
+ }
757
761
 
758
762
  const baseApis = {
759
763
  $on,
@@ -761,6 +765,7 @@ const baseApis = {
761
765
  $once,
762
766
  $emit,
763
767
  upx2px,
768
+ interceptors,
764
769
  addInterceptor,
765
770
  removeInterceptor,
766
771
  onAppLaunch,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-quickapp-webview",
3
- "version": "2.0.0-alpha-32720210917004",
3
+ "version": "2.0.0-alpha-32920210930002",
4
4
  "description": "uni-app quickapp-webview",
5
5
  "main": "dist/index.js",
6
6
  "repository": {
@@ -17,5 +17,5 @@
17
17
  "name": "quickapp-webview",
18
18
  "title": "快应用(Webview)版"
19
19
  },
20
- "gitHead": "09631b90bcdf962c5fec4265ff271af7d3a8b6b7"
20
+ "gitHead": "cf36ed570655fbc82d5af0f2d7cceb8e2e3cc07c"
21
21
  }