@dcloudio/uni-app-plus 2.0.1-33520211229001 → 2.0.1-33920220121002

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
@@ -726,9 +726,15 @@ const customize = cached((str) => {
726
726
 
727
727
  function initTriggerEvent (mpInstance) {
728
728
  const oldTriggerEvent = mpInstance.triggerEvent;
729
- mpInstance.triggerEvent = function (event, ...args) {
729
+ const newTriggerEvent = function (event, ...args) {
730
730
  return oldTriggerEvent.apply(mpInstance, [customize(event), ...args])
731
731
  };
732
+ try {
733
+ // 京东小程序 triggerEvent 为只读
734
+ mpInstance.triggerEvent = newTriggerEvent;
735
+ } catch (error) {
736
+ mpInstance._triggerEvent = newTriggerEvent;
737
+ }
732
738
  }
733
739
 
734
740
  function initHook (name, options, isComponent) {
@@ -2128,17 +2134,17 @@ function createPlugin (vm) {
2128
2134
  const appOptions = parseApp$1(vm);
2129
2135
  if (isFn(appOptions.onShow) && wx.onAppShow) {
2130
2136
  wx.onAppShow((...args) => {
2131
- appOptions.onShow.apply(vm, args);
2137
+ vm.__call_hook('onShow', args);
2132
2138
  });
2133
2139
  }
2134
2140
  if (isFn(appOptions.onHide) && wx.onAppHide) {
2135
2141
  wx.onAppHide((...args) => {
2136
- appOptions.onHide.apply(vm, args);
2142
+ vm.__call_hook('onHide', args);
2137
2143
  });
2138
2144
  }
2139
2145
  if (isFn(appOptions.onLaunch)) {
2140
2146
  const args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
2141
- appOptions.onLaunch.call(vm, args);
2147
+ vm.__call_hook('onLaunch', args);
2142
2148
  }
2143
2149
  return vm
2144
2150
  }
package/dist/index.v3.js CHANGED
@@ -250,7 +250,8 @@ var serviceContext = (function () {
250
250
  'restoreGlobal',
251
251
  'getSubNVueById',
252
252
  'getCurrentSubNVue',
253
- 'setPageMeta',
253
+ 'setPageMeta',
254
+ 'onHostEventReceive',
254
255
  'onNativeEventReceive',
255
256
  'sendNativeEvent',
256
257
  'preloadPage',
@@ -4365,7 +4366,7 @@ var serviceContext = (function () {
4365
4366
  return array.length > 1 ? '.' + array[array.length - 1] : ''
4366
4367
  }
4367
4368
 
4368
- const AUDIO_DEFAULT_CATEGORY = 'ambient';
4369
+ const AUDIO_DEFAULT_SESSION_CATEGORY = 'playback';
4369
4370
 
4370
4371
  const audios = {};
4371
4372
 
@@ -4413,7 +4414,7 @@ var serviceContext = (function () {
4413
4414
  audio.src = '';
4414
4415
  audio.volume = 1;
4415
4416
  audio.startTime = 0;
4416
- audio.setSessionCategory(AUDIO_DEFAULT_CATEGORY);
4417
+ audio.setSessionCategory(AUDIO_DEFAULT_SESSION_CATEGORY);
4417
4418
  return {
4418
4419
  errMsg: 'createAudioInstance:ok',
4419
4420
  audioId
@@ -4441,7 +4442,7 @@ var serviceContext = (function () {
4441
4442
  loop = false,
4442
4443
  obeyMuteSwitch,
4443
4444
  volume,
4444
- category = AUDIO_DEFAULT_CATEGORY
4445
+ sessionCategory = AUDIO_DEFAULT_SESSION_CATEGORY
4445
4446
  }) {
4446
4447
  const audio = audios[audioId];
4447
4448
  if (audio) {
@@ -4459,8 +4460,8 @@ var serviceContext = (function () {
4459
4460
  audio.volume = style.volume = volume;
4460
4461
  }
4461
4462
  audio.setStyles(style);
4462
- if (category) {
4463
- audio.setSessionCategory(category);
4463
+ if (sessionCategory) {
4464
+ audio.setSessionCategory(sessionCategory);
4464
4465
  }
4465
4466
  initStateChage(audioId);
4466
4467
  }
@@ -6758,6 +6759,7 @@ var serviceContext = (function () {
6758
6759
  type = 'wgs84',
6759
6760
  geocode = false,
6760
6761
  altitude = false,
6762
+ isHighAccuracy = false,
6761
6763
  highAccuracyExpireTime
6762
6764
  } = {}, callbackId) {
6763
6765
  const errorCallback = warpPlusErrorCallback(callbackId, 'getLocation');
@@ -6774,7 +6776,7 @@ var serviceContext = (function () {
6774
6776
  errorCallback(e);
6775
6777
  }, {
6776
6778
  geocode: geocode,
6777
- enableHighAccuracy: altitude,
6779
+ enableHighAccuracy: isHighAccuracy || altitude,
6778
6780
  timeout: highAccuracyExpireTime,
6779
6781
  coordsType: type
6780
6782
  }
@@ -7541,46 +7543,59 @@ var serviceContext = (function () {
7541
7543
  firstIpv4: firstIpv4,
7542
7544
  tls
7543
7545
  };
7546
+ let withArrayBuffer;
7544
7547
  if (method !== 'GET') {
7545
- options.body = typeof data === 'string' ? data : JSON.stringify(data);
7548
+ if (toString.call(data) === '[object ArrayBuffer]') {
7549
+ withArrayBuffer = true;
7550
+ } else {
7551
+ options.body = typeof data === 'string' ? data : JSON.stringify(data);
7552
+ }
7546
7553
  }
7547
- try {
7548
- stream.fetch(options, ({
7549
- ok,
7550
- status,
7551
- data,
7552
- headers,
7553
- errorMsg
7554
- }) => {
7555
- if (aborted) {
7556
- return
7557
- }
7558
- if (abortTimeout) {
7559
- clearTimeout(abortTimeout);
7560
- }
7561
- const statusCode = status;
7562
- if (statusCode > 0) {
7563
- publishStateChange$1({
7564
- requestTaskId,
7565
- state: 'success',
7566
- data: ok && responseType === 'arraybuffer' ? base64ToArrayBuffer$2(data) : data,
7567
- statusCode,
7568
- header: headers,
7569
- cookies: cookiesParse(headers)
7570
- });
7571
- } else {
7572
- let errMsg = 'abort statusCode:' + statusCode;
7573
- if (errorMsg) {
7574
- errMsg = errMsg + ' ' + errorMsg;
7575
- }
7576
- publishStateChange$1({
7577
- requestTaskId,
7578
- state: 'fail',
7579
- statusCode,
7580
- errMsg
7581
- });
7554
+ const callback = ({
7555
+ ok,
7556
+ status,
7557
+ data,
7558
+ headers,
7559
+ errorMsg
7560
+ }) => {
7561
+ if (aborted) {
7562
+ return
7563
+ }
7564
+ if (abortTimeout) {
7565
+ clearTimeout(abortTimeout);
7566
+ }
7567
+ const statusCode = status;
7568
+ if (statusCode > 0) {
7569
+ publishStateChange$1({
7570
+ requestTaskId,
7571
+ state: 'success',
7572
+ data: ok && responseType === 'arraybuffer' ? base64ToArrayBuffer$2(data) : data,
7573
+ statusCode,
7574
+ header: headers,
7575
+ cookies: cookiesParse(headers)
7576
+ });
7577
+ } else {
7578
+ let errMsg = 'abort statusCode:' + statusCode;
7579
+ if (errorMsg) {
7580
+ errMsg = errMsg + ' ' + errorMsg;
7582
7581
  }
7583
- });
7582
+ publishStateChange$1({
7583
+ requestTaskId,
7584
+ state: 'fail',
7585
+ statusCode,
7586
+ errMsg
7587
+ });
7588
+ }
7589
+ };
7590
+ try {
7591
+ if (withArrayBuffer) {
7592
+ stream.fetchWithArrayBuffer({
7593
+ '@type': 'binary',
7594
+ base64: arrayBufferToBase64$2(data)
7595
+ }, options, callback);
7596
+ } else {
7597
+ stream.fetch(options, callback);
7598
+ }
7584
7599
  requestTasks[requestTaskId] = {
7585
7600
  abort () {
7586
7601
  aborted = true;
@@ -8130,7 +8145,7 @@ var serviceContext = (function () {
8130
8145
  }
8131
8146
 
8132
8147
  login (options) {
8133
- this._warp((data, callbackId) => login(data, callbackId, false), this._getOptions(options));
8148
+ this._warp((data, callbackId) => login(data, callbackId, false), options);
8134
8149
  }
8135
8150
 
8136
8151
  getCheckBoxState (options) {
@@ -8138,7 +8153,7 @@ var serviceContext = (function () {
8138
8153
  }
8139
8154
 
8140
8155
  preLogin (options) {
8141
- this._warp((data, callbackId) => preLogin$1(data, callbackId, false), this._getOptions(options));
8156
+ this._warp((data, callbackId) => preLogin$1(data, callbackId, false), options);
8142
8157
  }
8143
8158
 
8144
8159
  onButtonsClick (callback) {
@@ -8587,6 +8602,10 @@ var serviceContext = (function () {
8587
8602
  });
8588
8603
  });
8589
8604
 
8605
+ function onHostEventReceive (callbackId) {
8606
+ callbacks$3.push(callbackId);
8607
+ }
8608
+
8590
8609
  function onNativeEventReceive (callbackId) {
8591
8610
  callbacks$3.push(callbackId);
8592
8611
  }
@@ -11330,9 +11349,7 @@ var serviceContext = (function () {
11330
11349
  this._dispatchEvent('adClicked', {});
11331
11350
  });
11332
11351
 
11333
- if (this._preload) {
11334
- this._loadAd();
11335
- }
11352
+ this._loadAd();
11336
11353
  }
11337
11354
 
11338
11355
  get isExpired () {
@@ -11956,6 +11973,7 @@ var serviceContext = (function () {
11956
11973
  restoreGlobal: restoreGlobal,
11957
11974
  getSubNVueById: getSubNVueById,
11958
11975
  getCurrentSubNVue: getCurrentSubNVue,
11976
+ onHostEventReceive: onHostEventReceive,
11959
11977
  onNativeEventReceive: onNativeEventReceive,
11960
11978
  sendNativeEvent: sendNativeEvent,
11961
11979
  loadSubPackage: loadSubPackage$2,
@@ -15787,7 +15805,7 @@ var serviceContext = (function () {
15787
15805
 
15788
15806
  var zstream = ZStream;
15789
15807
 
15790
- var toString = Object.prototype.toString;
15808
+ var toString$1 = Object.prototype.toString;
15791
15809
 
15792
15810
  /* Public constants ==========================================================*/
15793
15811
  /* ===========================================================================*/
@@ -15951,7 +15969,7 @@ var serviceContext = (function () {
15951
15969
  if (typeof opt.dictionary === 'string') {
15952
15970
  // If we need to compress text, change encoding to utf8.
15953
15971
  dict = strings.string2buf(opt.dictionary);
15954
- } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {
15972
+ } else if (toString$1.call(opt.dictionary) === '[object ArrayBuffer]') {
15955
15973
  dict = new Uint8Array(opt.dictionary);
15956
15974
  } else {
15957
15975
  dict = opt.dictionary;
@@ -16009,7 +16027,7 @@ var serviceContext = (function () {
16009
16027
  if (typeof data === 'string') {
16010
16028
  // If we need to compress text, change encoding to utf8.
16011
16029
  strm.input = strings.string2buf(data);
16012
- } else if (toString.call(data) === '[object ArrayBuffer]') {
16030
+ } else if (toString$1.call(data) === '[object ArrayBuffer]') {
16013
16031
  strm.input = new Uint8Array(data);
16014
16032
  } else {
16015
16033
  strm.input = data;
@@ -18561,7 +18579,7 @@ var serviceContext = (function () {
18561
18579
 
18562
18580
  var gzheader = GZheader;
18563
18581
 
18564
- var toString$1 = Object.prototype.toString;
18582
+ var toString$2 = Object.prototype.toString;
18565
18583
 
18566
18584
  /**
18567
18585
  * class Inflate
@@ -18702,7 +18720,7 @@ var serviceContext = (function () {
18702
18720
  // Convert data if needed
18703
18721
  if (typeof opt.dictionary === 'string') {
18704
18722
  opt.dictionary = strings.string2buf(opt.dictionary);
18705
- } else if (toString$1.call(opt.dictionary) === '[object ArrayBuffer]') {
18723
+ } else if (toString$2.call(opt.dictionary) === '[object ArrayBuffer]') {
18706
18724
  opt.dictionary = new Uint8Array(opt.dictionary);
18707
18725
  }
18708
18726
  if (opt.raw) { //In raw mode we need to set the dictionary early
@@ -18760,7 +18778,7 @@ var serviceContext = (function () {
18760
18778
  if (typeof data === 'string') {
18761
18779
  // Only binary strings can be decompressed on practice
18762
18780
  strm.input = strings.binstring2buf(data);
18763
- } else if (toString$1.call(data) === '[object ArrayBuffer]') {
18781
+ } else if (toString$2.call(data) === '[object ArrayBuffer]') {
18764
18782
  strm.input = new Uint8Array(data);
18765
18783
  } else {
18766
18784
  strm.input = data;
@@ -20134,6 +20152,9 @@ var serviceContext = (function () {
20134
20152
  },
20135
20153
  {
20136
20154
  name: 'volume'
20155
+ },
20156
+ {
20157
+ name: 'sessionCategory'
20137
20158
  }
20138
20159
  ];
20139
20160