@tarojs/taro-h5 3.6.5 → 3.7.0-alpha.0
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/api/ai/index.d.ts +2 -2
- package/dist/api/base/index.d.ts +7 -7
- package/dist/api/canvas/index.d.ts +4 -4
- package/dist/api/device/index.d.ts +23 -23
- package/dist/api/index.d.ts +24 -24
- package/dist/api/index.js +1 -1
- package/dist/api/location/index.d.ts +2 -2
- package/dist/api/media/audio/InnerAudioContext.d.ts +1 -1
- package/dist/api/media/background-audio/BackgroundAudioManager.d.ts +1 -1
- package/dist/api/media/background-audio/index.d.ts +1 -1
- package/dist/api/media/image/index.d.ts +3 -3
- package/dist/api/media/index.d.ts +12 -12
- package/dist/api/network/index.d.ts +7 -7
- package/dist/api/network/index.js +1 -1
- package/dist/api/network/request/index.d.ts +2 -1
- package/dist/api/network/request/index.js +2 -1
- package/dist/api/network/request/index.js.map +1 -1
- package/dist/api/open-api/index.d.ts +18 -18
- package/dist/api/storage/index.d.ts +1 -1
- package/dist/api/taro.js +9 -4
- package/dist/api/taro.js.map +1 -1
- package/dist/api/ui/index.d.ts +12 -12
- package/dist/api/wxml/IntersectionObserver.js +7 -7
- package/dist/api/wxml/IntersectionObserver.js.map +1 -1
- package/dist/api/wxml/nodesRef.d.ts +1 -1
- package/dist/api/wxml/selectorQuery.d.ts +1 -1
- package/dist/index.cjs.d.ts +2 -1
- package/dist/index.cjs.js +18 -11
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.esm.d.ts +2 -1
- package/dist/index.esm.js +18 -12
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/utils/index.d.ts +3 -3
- package/package.json +6 -6
package/dist/api/ai/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./facial
|
|
2
|
-
export * from "./visual
|
|
1
|
+
export * from "./facial";
|
|
2
|
+
export * from "./visual";
|
package/dist/api/base/index.d.ts
CHANGED
|
@@ -8,10 +8,10 @@ declare const canIUse: (option?: {}, ...args: any[]) => Promise<Partial<TaroGene
|
|
|
8
8
|
declare function arrayBufferToBase64(arrayBuffer: ArrayBuffer): string;
|
|
9
9
|
declare function base64ToArrayBuffer(base64: string): Uint8Array;
|
|
10
10
|
export { env, canIUse, arrayBufferToBase64, base64ToArrayBuffer };
|
|
11
|
-
export * from "./crypto
|
|
12
|
-
export * from "./debug
|
|
13
|
-
export * from "./performance
|
|
14
|
-
export * from "./system
|
|
15
|
-
export * from "./update
|
|
16
|
-
export * from "./weapp/app-event
|
|
17
|
-
export * from "./weapp/life-cycle
|
|
11
|
+
export * from "./crypto";
|
|
12
|
+
export * from "./debug";
|
|
13
|
+
export * from "./performance";
|
|
14
|
+
export * from "./system";
|
|
15
|
+
export * from "./update";
|
|
16
|
+
export * from "./weapp/app-event";
|
|
17
|
+
export * from "./weapp/life-cycle";
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
declare const createOffscreenCanvas: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
3
3
|
export { createOffscreenCanvas };
|
|
4
4
|
/** 创建 canvas 的绘图上下文 CanvasContext 对象 */
|
|
5
|
-
export * from "./createCanvasContext
|
|
5
|
+
export * from "./createCanvasContext";
|
|
6
6
|
/** 把当前画布指定区域的内容导出生成指定大小的图片 */
|
|
7
|
-
export * from "./canvasToTempFilePath
|
|
7
|
+
export * from "./canvasToTempFilePath";
|
|
8
8
|
/** 将像素数据绘制到画布 */
|
|
9
|
-
export * from "./canvasPutImageData
|
|
9
|
+
export * from "./canvasPutImageData";
|
|
10
10
|
/** 获取 canvas 区域隐含的像素数据 */
|
|
11
|
-
export * from "./canvasGetImageData
|
|
11
|
+
export * from "./canvasGetImageData";
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
export * from "./accelerometer
|
|
2
|
-
export * from "./accessibility
|
|
3
|
-
export * from "./battery
|
|
4
|
-
export * from "./bluetooth
|
|
5
|
-
export * from "./bluetooth-ble
|
|
6
|
-
export * from "./bluetooth-peripheral
|
|
7
|
-
export * from "./calendar
|
|
8
|
-
export * from "./clipboard
|
|
9
|
-
export * from "./compass
|
|
10
|
-
export * from "./contact
|
|
11
|
-
export * from "./crypto
|
|
12
|
-
export * from "./gyroscope
|
|
13
|
-
export * from "./iBeacon
|
|
14
|
-
export * from "./keyboard
|
|
15
|
-
export * from "./memory
|
|
16
|
-
export * from "./motion
|
|
17
|
-
export * from "./network
|
|
18
|
-
export * from "./nfc
|
|
19
|
-
export * from "./phone
|
|
20
|
-
export * from "./scan
|
|
21
|
-
export * from "./screen
|
|
22
|
-
export * from "./vibrate
|
|
23
|
-
export * from "./wifi
|
|
1
|
+
export * from "./accelerometer";
|
|
2
|
+
export * from "./accessibility";
|
|
3
|
+
export * from "./battery";
|
|
4
|
+
export * from "./bluetooth";
|
|
5
|
+
export * from "./bluetooth-ble";
|
|
6
|
+
export * from "./bluetooth-peripheral";
|
|
7
|
+
export * from "./calendar";
|
|
8
|
+
export * from "./clipboard";
|
|
9
|
+
export * from "./compass";
|
|
10
|
+
export * from "./contact";
|
|
11
|
+
export * from "./crypto";
|
|
12
|
+
export * from "./gyroscope";
|
|
13
|
+
export * from "./iBeacon";
|
|
14
|
+
export * from "./keyboard";
|
|
15
|
+
export * from "./memory";
|
|
16
|
+
export * from "./motion";
|
|
17
|
+
export * from "./network";
|
|
18
|
+
export * from "./nfc";
|
|
19
|
+
export * from "./phone";
|
|
20
|
+
export * from "./scan";
|
|
21
|
+
export * from "./screen";
|
|
22
|
+
export * from "./vibrate";
|
|
23
|
+
export * from "./wifi";
|
package/dist/api/index.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
export * from "./ad/index
|
|
2
|
-
export * from "./ai/index
|
|
3
|
-
export * from "./alipay/index
|
|
4
|
-
export * from "./base/index
|
|
5
|
-
export * from "./canvas/index
|
|
6
|
-
export * from "./cloud/index
|
|
7
|
-
export * from "./data-analysis/index
|
|
8
|
-
export * from "./device/index
|
|
9
|
-
export * from "./ext/index
|
|
10
|
-
export * from "./files/index
|
|
11
|
-
export * from "./framework/index
|
|
12
|
-
export * from "./location/index
|
|
13
|
-
export * from "./media/index
|
|
14
|
-
export * from "./navigate/index
|
|
15
|
-
export * from "./network/index
|
|
16
|
-
export * from "./open-api/index
|
|
17
|
-
export * from "./payment/index
|
|
18
|
-
export * from "./route/index
|
|
19
|
-
export * from "./share/index
|
|
20
|
-
export * from "./storage/index
|
|
21
|
-
export * from "./swan/index
|
|
22
|
-
export * from "./ui/index
|
|
23
|
-
export * from "./worker/index
|
|
24
|
-
export * from "./wxml/index
|
|
1
|
+
export * from "./ad/index";
|
|
2
|
+
export * from "./ai/index";
|
|
3
|
+
export * from "./alipay/index";
|
|
4
|
+
export * from "./base/index";
|
|
5
|
+
export * from "./canvas/index";
|
|
6
|
+
export * from "./cloud/index";
|
|
7
|
+
export * from "./data-analysis/index";
|
|
8
|
+
export * from "./device/index";
|
|
9
|
+
export * from "./ext/index";
|
|
10
|
+
export * from "./files/index";
|
|
11
|
+
export * from "./framework/index";
|
|
12
|
+
export * from "./location/index";
|
|
13
|
+
export * from "./media/index";
|
|
14
|
+
export * from "./navigate/index";
|
|
15
|
+
export * from "./network/index";
|
|
16
|
+
export * from "./open-api/index";
|
|
17
|
+
export * from "./payment/index";
|
|
18
|
+
export * from "./route/index";
|
|
19
|
+
export * from "./share/index";
|
|
20
|
+
export * from "./storage/index";
|
|
21
|
+
export * from "./swan/index";
|
|
22
|
+
export * from "./ui/index";
|
|
23
|
+
export * from "./worker/index";
|
|
24
|
+
export * from "./wxml/index";
|
package/dist/api/index.js
CHANGED
|
@@ -78,7 +78,7 @@ export { createMediaContainer } from './media/video-processing.js';
|
|
|
78
78
|
export { exitVoIPChat, joinVoIPChat, offVoIPChatInterrupted, offVoIPChatMembersChanged, offVoIPChatStateChanged, offVoIPVideoMembersChanged, onVoIPChatInterrupted, onVoIPChatMembersChanged, onVoIPChatSpeakersChanged, onVoIPChatStateChanged, onVoIPVideoMembersChanged, setEnable1v1Chat, subscribeVoIPVideoMembers, updateVoIPChatMuteConfig } from './media/voip.js';
|
|
79
79
|
export { downloadFile } from './network/download.js';
|
|
80
80
|
export { offLocalServiceDiscoveryStop, offLocalServiceFound, offLocalServiceLost, offLocalServiceResolveFail, onLocalServiceDiscoveryStop, onLocalServiceFound, onLocalServiceLost, onLocalServiceResolveFail, startLocalServiceDiscovery, stopLocalServiceDiscovery } from './network/mdns.js';
|
|
81
|
-
export { addInterceptor, request } from './network/request/index.js';
|
|
81
|
+
export { addInterceptor, cleanInterceptors, request } from './network/request/index.js';
|
|
82
82
|
export { createTCPSocket } from './network/tcp.js';
|
|
83
83
|
export { createUDPSocket } from './network/udp.js';
|
|
84
84
|
export { uploadFile } from './network/upload.js';
|
|
@@ -11,5 +11,5 @@ declare const offLocationChange: (option?: {}, ...args: any[]) => Promise<Partia
|
|
|
11
11
|
declare const choosePoi: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
12
12
|
declare const getFuzzyLocation: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
13
13
|
export { stopLocationUpdate, startLocationUpdateBackground, startLocationUpdate, openLocation, onLocationChangeError, onLocationChange, offLocationChangeError, offLocationChange, choosePoi, getFuzzyLocation };
|
|
14
|
-
export { getLocation } from "./getLocation
|
|
15
|
-
export { chooseLocation } from "./chooseLocation
|
|
14
|
+
export { getLocation } from "./getLocation";
|
|
15
|
+
export { chooseLocation } from "./chooseLocation";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Taro from '@tarojs/api';
|
|
2
|
-
import { CallbackManager } from "../../../utils/handler
|
|
2
|
+
import { CallbackManager } from "../../../utils/handler";
|
|
3
3
|
declare class InnerAudioContext implements Taro.InnerAudioContext {
|
|
4
4
|
Instance?: HTMLAudioElement;
|
|
5
5
|
errorStack: CallbackManager;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Taro from '@tarojs/api';
|
|
2
|
-
import { CallbackManager } from "../../../utils/handler
|
|
2
|
+
import { CallbackManager } from "../../../utils/handler";
|
|
3
3
|
declare class BackgroundAudioManager implements Taro.BackgroundAudioManager {
|
|
4
4
|
Instance?: HTMLAudioElement;
|
|
5
5
|
errorStack: CallbackManager;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BackgroundAudioManager } from "./BackgroundAudioManager
|
|
1
|
+
import { BackgroundAudioManager } from "./BackgroundAudioManager";
|
|
2
2
|
declare const stopBackgroundAudio: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
3
3
|
declare const seekBackgroundAudio: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
4
4
|
declare const playBackgroundAudio: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
@@ -3,6 +3,6 @@ declare const previewMedia: (option?: {}, ...args: any[]) => Promise<Partial<Tar
|
|
|
3
3
|
declare const compressImage: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
4
4
|
declare const chooseMessageFile: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
5
5
|
export { saveImageToPhotosAlbum, previewMedia, compressImage, chooseMessageFile };
|
|
6
|
-
export * from "./getImageInfo
|
|
7
|
-
export * from "./previewImage
|
|
8
|
-
export * from "./chooseImage
|
|
6
|
+
export * from "./getImageInfo";
|
|
7
|
+
export * from "./previewImage";
|
|
8
|
+
export * from "./chooseImage";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export * from "./audio/index
|
|
2
|
-
export * from "./background-audio/index
|
|
3
|
-
export * from "./camera
|
|
4
|
-
export * from "./image/index
|
|
5
|
-
export * from "./live
|
|
6
|
-
export * from "./map
|
|
7
|
-
export * from "./media-recorder
|
|
8
|
-
export * from "./recorder
|
|
9
|
-
export * from "./video/index
|
|
10
|
-
export * from "./video-decoder
|
|
11
|
-
export * from "./video-processing
|
|
12
|
-
export * from "./voip
|
|
1
|
+
export * from "./audio/index";
|
|
2
|
+
export * from "./background-audio/index";
|
|
3
|
+
export * from "./camera";
|
|
4
|
+
export * from "./image/index";
|
|
5
|
+
export * from "./live";
|
|
6
|
+
export * from "./map";
|
|
7
|
+
export * from "./media-recorder";
|
|
8
|
+
export * from "./recorder";
|
|
9
|
+
export * from "./video/index";
|
|
10
|
+
export * from "./video-decoder";
|
|
11
|
+
export * from "./video-processing";
|
|
12
|
+
export * from "./voip";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from "./download
|
|
2
|
-
export * from "./mdns
|
|
3
|
-
export * from "./request/index
|
|
4
|
-
export * from "./tcp
|
|
5
|
-
export * from "./udp
|
|
6
|
-
export * from "./upload
|
|
7
|
-
export * from "./websocket/index
|
|
1
|
+
export * from "./download";
|
|
2
|
+
export * from "./mdns";
|
|
3
|
+
export * from "./request/index";
|
|
4
|
+
export * from "./tcp";
|
|
5
|
+
export * from "./udp";
|
|
6
|
+
export * from "./upload";
|
|
7
|
+
export * from "./websocket/index";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { downloadFile } from './download.js';
|
|
2
2
|
export { offLocalServiceDiscoveryStop, offLocalServiceFound, offLocalServiceLost, offLocalServiceResolveFail, onLocalServiceDiscoveryStop, onLocalServiceFound, onLocalServiceLost, onLocalServiceResolveFail, startLocalServiceDiscovery, stopLocalServiceDiscovery } from './mdns.js';
|
|
3
|
-
export { addInterceptor, request } from './request/index.js';
|
|
3
|
+
export { addInterceptor, cleanInterceptors, request } from './request/index.js';
|
|
4
4
|
export { createTCPSocket } from './tcp.js';
|
|
5
5
|
export { createUDPSocket } from './udp.js';
|
|
6
6
|
export { uploadFile } from './upload.js';
|
|
@@ -147,6 +147,7 @@ function taroInterceptor(chain) {
|
|
|
147
147
|
const link = new Link(taroInterceptor);
|
|
148
148
|
const request = link.request.bind(link);
|
|
149
149
|
const addInterceptor = link.addInterceptor.bind(link);
|
|
150
|
+
const cleanInterceptors = link.cleanInterceptors.bind(link);
|
|
150
151
|
|
|
151
|
-
export { addInterceptor, request };
|
|
152
|
+
export { addInterceptor, cleanInterceptors, request };
|
|
152
153
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/api/network/request/index.ts"],"sourcesContent":["import 'whatwg-fetch'\nimport 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only'\n\nimport Taro from '@tarojs/api'\nimport { isFunction } from '@tarojs/shared'\nimport jsonpRetry from 'jsonp-retry'\n\nimport { serializeParams } from '../../../utils'\n\n// @ts-ignore\nconst { Link } = Taro\n\nfunction generateRequestUrlWithParams (url: string, params?: unknown) {\n params = typeof params === 'string' ? params : serializeParams(params)\n if (params) {\n url += (~url.indexOf('?') ? '&' : '?') + params\n }\n url = url.replace('?&', '?')\n return url\n}\n\n// FIXME 移除 any 标注\nfunction _request (options) {\n options = options || {}\n if (typeof options === 'string') {\n options = {\n url: options\n }\n }\n const { success, complete, fail } = options\n let url = options.url\n const params: any = {}\n const res: any = {}\n if (options.jsonp) {\n Object.assign(params, options)\n params.params = options.data\n params.cache = options.jsonpCache\n if (typeof options.jsonp === 'string') {\n params.name = options.jsonp\n }\n delete params.jsonp\n return jsonpRetry(url, params)\n .then(data => {\n res.statusCode = 200\n res.data = data\n isFunction(success) && success(res)\n isFunction(complete) && complete(res)\n return res\n })\n .catch(err => {\n isFunction(fail) && fail(err)\n isFunction(complete) && complete(res)\n return Promise.reject(err)\n })\n }\n params.method = options.method || 'GET'\n const methodUpper = params.method.toUpperCase()\n params.cache = options.cache || 'default'\n if (methodUpper === 'GET' || methodUpper === 'HEAD') {\n url = generateRequestUrlWithParams(url, options.data)\n } else if (Object.prototype.toString.call(options.data) === '[object Object]') {\n options.header = options.header || {}\n\n const keyOfContentType = Object.keys(options.header).find(item => item.toLowerCase() === 'content-type')\n if (!keyOfContentType) {\n options.header['Content-Type'] = 'application/json'\n }\n const contentType = options.header[keyOfContentType || 'Content-Type']\n\n if (contentType.indexOf('application/json') >= 0) {\n params.body = JSON.stringify(options.data)\n } else if (contentType.indexOf('application/x-www-form-urlencoded') >= 0) {\n params.body = serializeParams(options.data)\n } else {\n params.body = options.data\n }\n } else {\n params.body = options.data\n }\n if (options.header) {\n params.headers = options.header\n }\n if (options.mode) {\n params.mode = options.mode\n }\n let timeoutTimer: ReturnType<typeof setTimeout> | null = null\n if (options.signal) {\n params.signal = options.signal\n } else if (typeof options.timeout === 'number') {\n const controller = new window.AbortController()\n params.signal = controller.signal\n timeoutTimer = setTimeout(function () {\n controller.abort()\n }, options.timeout)\n }\n params.credentials = options.credentials\n return fetch(url, params)\n .then(response => {\n if (timeoutTimer) {\n clearTimeout(timeoutTimer)\n timeoutTimer = null\n }\n if (!response) {\n const errorResponse = { ok: false }\n throw errorResponse\n }\n res.statusCode = response.status\n res.header = {}\n for (const key of response.headers.keys()) {\n res.header[key] = response.headers.get(key)\n }\n if (options.responseType === 'arraybuffer') {\n return response.arrayBuffer()\n }\n if (res.statusCode !== 204) {\n if (options.dataType === 'json' || typeof options.dataType === 'undefined') {\n return response.json().catch(() => {\n return null\n })\n }\n }\n if (options.responseType === 'text' || options.dataType === 'text') {\n return response.text()\n }\n return Promise.resolve(null)\n })\n .then(data => {\n res.data = data\n isFunction(success) && success(res)\n isFunction(complete) && complete(res)\n return res\n })\n .catch(err => {\n if (timeoutTimer) {\n clearTimeout(timeoutTimer)\n timeoutTimer = null\n }\n isFunction(fail) && fail(err)\n isFunction(complete) && complete(res)\n err.statusCode = res.statusCode\n err.errMsg = err.message\n return Promise.reject(err)\n })\n}\n\nfunction taroInterceptor (chain) {\n return _request(chain.requestParams)\n}\n\nconst link = new Link(taroInterceptor)\n\nexport const request: typeof Taro.request = link.request.bind(link)\nexport const addInterceptor = link.addInterceptor.bind(link)\n"],"names":[],"mappings":";;;;;;;AASA;AACA,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAA;AAErB,SAAS,4BAA4B,CAAE,GAAW,EAAE,MAAgB,EAAA;AAClE,IAAA,MAAM,GAAG,OAAO,MAAM,KAAK,QAAQ,GAAG,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC,CAAA;AACtE,IAAA,IAAI,MAAM,EAAE;QACV,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,IAAI,MAAM,CAAA;AAChD,KAAA;IACD,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;AAC5B,IAAA,OAAO,GAAG,CAAA;AACZ,CAAC;AAED;AACA,SAAS,QAAQ,CAAE,OAAO,EAAA;AACxB,IAAA,OAAO,GAAG,OAAO,IAAI,EAAE,CAAA;AACvB,IAAA,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;AAC/B,QAAA,OAAO,GAAG;AACR,YAAA,GAAG,EAAE,OAAO;SACb,CAAA;AACF,KAAA;IACD,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,OAAO,CAAA;AAC3C,IAAA,IAAI,GAAG,GAAG,OAAO,CAAC,GAAG,CAAA;IACrB,MAAM,MAAM,GAAQ,EAAE,CAAA;IACtB,MAAM,GAAG,GAAQ,EAAE,CAAA;IACnB,IAAI,OAAO,CAAC,KAAK,EAAE;AACjB,QAAA,MAAM,CAAC,MAAM,CAAC,MAAM,EAA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AG,CAAC,MAAM,GAAG,GAAG,CAAC,OAAO,CAAA;AACxB,QAAA,OAAO,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;AAC5B,KAAC,CAAC,CAAA;AACN,CAAC;AAED,SAAS,eAAe,CAAE,KAAK,EAAA;AAC7B,IAAA,OAAO,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;AACtC,CAAC;AAED,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,eAAe,CAAC,CAAA;AAE/B,MAAM,OAAO,GAAwB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAC;AAC5D,MAAM,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/api/network/request/index.ts"],"sourcesContent":["import 'whatwg-fetch'\nimport 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only'\n\nimport Taro from '@tarojs/api'\nimport { isFunction } from '@tarojs/shared'\nimport jsonpRetry from 'jsonp-retry'\n\nimport { serializeParams } from '../../../utils'\n\n// @ts-ignore\nconst { Link } = Taro\n\nfunction generateRequestUrlWithParams (url: string, params?: unknown) {\n params = typeof params === 'string' ? params : serializeParams(params)\n if (params) {\n url += (~url.indexOf('?') ? '&' : '?') + params\n }\n url = url.replace('?&', '?')\n return url\n}\n\n// FIXME 移除 any 标注\nfunction _request (options) {\n options = options || {}\n if (typeof options === 'string') {\n options = {\n url: options\n }\n }\n const { success, complete, fail } = options\n let url = options.url\n const params: any = {}\n const res: any = {}\n if (options.jsonp) {\n Object.assign(params, options)\n params.params = options.data\n params.cache = options.jsonpCache\n if (typeof options.jsonp === 'string') {\n params.name = options.jsonp\n }\n delete params.jsonp\n return jsonpRetry(url, params)\n .then(data => {\n res.statusCode = 200\n res.data = data\n isFunction(success) && success(res)\n isFunction(complete) && complete(res)\n return res\n })\n .catch(err => {\n isFunction(fail) && fail(err)\n isFunction(complete) && complete(res)\n return Promise.reject(err)\n })\n }\n params.method = options.method || 'GET'\n const methodUpper = params.method.toUpperCase()\n params.cache = options.cache || 'default'\n if (methodUpper === 'GET' || methodUpper === 'HEAD') {\n url = generateRequestUrlWithParams(url, options.data)\n } else if (Object.prototype.toString.call(options.data) === '[object Object]') {\n options.header = options.header || {}\n\n const keyOfContentType = Object.keys(options.header).find(item => item.toLowerCase() === 'content-type')\n if (!keyOfContentType) {\n options.header['Content-Type'] = 'application/json'\n }\n const contentType = options.header[keyOfContentType || 'Content-Type']\n\n if (contentType.indexOf('application/json') >= 0) {\n params.body = JSON.stringify(options.data)\n } else if (contentType.indexOf('application/x-www-form-urlencoded') >= 0) {\n params.body = serializeParams(options.data)\n } else {\n params.body = options.data\n }\n } else {\n params.body = options.data\n }\n if (options.header) {\n params.headers = options.header\n }\n if (options.mode) {\n params.mode = options.mode\n }\n let timeoutTimer: ReturnType<typeof setTimeout> | null = null\n if (options.signal) {\n params.signal = options.signal\n } else if (typeof options.timeout === 'number') {\n const controller = new window.AbortController()\n params.signal = controller.signal\n timeoutTimer = setTimeout(function () {\n controller.abort()\n }, options.timeout)\n }\n params.credentials = options.credentials\n return fetch(url, params)\n .then(response => {\n if (timeoutTimer) {\n clearTimeout(timeoutTimer)\n timeoutTimer = null\n }\n if (!response) {\n const errorResponse = { ok: false }\n throw errorResponse\n }\n res.statusCode = response.status\n res.header = {}\n for (const key of response.headers.keys()) {\n res.header[key] = response.headers.get(key)\n }\n if (options.responseType === 'arraybuffer') {\n return response.arrayBuffer()\n }\n if (res.statusCode !== 204) {\n if (options.dataType === 'json' || typeof options.dataType === 'undefined') {\n return response.json().catch(() => {\n return null\n })\n }\n }\n if (options.responseType === 'text' || options.dataType === 'text') {\n return response.text()\n }\n return Promise.resolve(null)\n })\n .then(data => {\n res.data = data\n isFunction(success) && success(res)\n isFunction(complete) && complete(res)\n return res\n })\n .catch(err => {\n if (timeoutTimer) {\n clearTimeout(timeoutTimer)\n timeoutTimer = null\n }\n isFunction(fail) && fail(err)\n isFunction(complete) && complete(res)\n err.statusCode = res.statusCode\n err.errMsg = err.message\n return Promise.reject(err)\n })\n}\n\nfunction taroInterceptor (chain) {\n return _request(chain.requestParams)\n}\n\nconst link = new Link(taroInterceptor)\n\nexport const request: typeof Taro.request = link.request.bind(link)\nexport const addInterceptor = link.addInterceptor.bind(link)\nexport const cleanInterceptors = link.cleanInterceptors.bind(link)\n"],"names":[],"mappings":";;;;;;;AASA;AACA,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAA;AAErB,SAAS,4BAA4B,CAAE,GAAW,EAAE,MAAgB,EAAA;AAClE,IAAA,MAAM,GAAG,OAAO,MAAM,KAAK,QAAQ,GAAG,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC,CAAA;AACtE,IAAA,IAAI,MAAM,EAAE;QACV,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,IAAI,MAAM,CAAA;AAChD,KAAA;IACD,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;AAC5B,IAAA,OAAO,GAAG,CAAA;AACZ,CAAC;AAED;AACA,SAAS,QAAQ,CAAE,OAAO,EAAA;AACxB,IAAA,OAAO,GAAG,OAAO,IAAI,EAAE,CAAA;AACvB,IAAA,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;AAC/B,QAAA,OAAO,GAAG;AACR,YAAA,GAAG,EAAE,OAAO;SACb,CAAA;AACF,KAAA;IACD,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,OAAO,CAAA;AAC3C,IAAA,IAAI,GAAG,GAAG,OAAO,CAAC,GAAG,CAAA;IACrB,MAAM,MAAM,GAAQ,EAAE,CAAA;IACtB,MAAM,GAAG,GAAQ,EAAE,CAAA;IACnB,IAAI,OAAO,CAAC,KAAK,EAAE;AACjB,QAAA,MAAM,CAAC,MAAM,CAAC,MA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AAA,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,OAAO,CAAA;AACxB,QAAA,OAAO,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;AAC5B,KAAC,CAAC,CAAA;AACN,CAAC;AAED,SAAS,eAAe,CAAE,KAAK,EAAA;AAC7B,IAAA,OAAO,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;AACtC,CAAC;AAED,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,eAAe,CAAC,CAAA;AAE/B,MAAM,OAAO,GAAwB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAC;AAC5D,MAAM,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAC;AACrD,MAAM,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI;;;;"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
export * from "./account
|
|
2
|
-
export * from "./address
|
|
3
|
-
export * from "./authorize
|
|
4
|
-
export * from "./card
|
|
5
|
-
export * from "./channels-live
|
|
6
|
-
export * from "./customer-service
|
|
7
|
-
export * from "./facial
|
|
8
|
-
export * from "./favorites
|
|
9
|
-
export * from "./group
|
|
10
|
-
export * from "./invoice
|
|
11
|
-
export * from "./license-plate
|
|
12
|
-
export * from "./login
|
|
13
|
-
export * from "./red-package
|
|
14
|
-
export * from "./settings
|
|
15
|
-
export * from "./soter
|
|
16
|
-
export * from "./subscribe-message
|
|
17
|
-
export * from "./user-info
|
|
18
|
-
export * from "./werun
|
|
1
|
+
export * from "./account";
|
|
2
|
+
export * from "./address";
|
|
3
|
+
export * from "./authorize";
|
|
4
|
+
export * from "./card";
|
|
5
|
+
export * from "./channels-live";
|
|
6
|
+
export * from "./customer-service";
|
|
7
|
+
export * from "./facial";
|
|
8
|
+
export * from "./favorites";
|
|
9
|
+
export * from "./group";
|
|
10
|
+
export * from "./invoice";
|
|
11
|
+
export * from "./license-plate";
|
|
12
|
+
export * from "./login";
|
|
13
|
+
export * from "./red-package";
|
|
14
|
+
export * from "./settings";
|
|
15
|
+
export * from "./soter";
|
|
16
|
+
export * from "./subscribe-message";
|
|
17
|
+
export * from "./user-info";
|
|
18
|
+
export * from "./werun";
|
|
@@ -12,4 +12,4 @@ declare const createBufferURL: (option?: {}, ...args: any[]) => Promise<Partial<
|
|
|
12
12
|
declare const clearStorageSync: typeof Taro.clearStorageSync;
|
|
13
13
|
declare const clearStorage: typeof Taro.clearStorage;
|
|
14
14
|
export { setStorageSync, setStorage, revokeBufferURL, removeStorageSync, removeStorage, getStorageSync, getStorageInfoSync, getStorageInfo, getStorage, createBufferURL, clearStorageSync, clearStorage };
|
|
15
|
-
export * from "./background-fetch
|
|
15
|
+
export * from "./background-fetch";
|
package/dist/api/taro.js
CHANGED
|
@@ -59,17 +59,22 @@ const pxTransform = function (size = 0) {
|
|
|
59
59
|
throw new Error(`deviceRatio 配置中不存在 ${designWidth} 的设置!`);
|
|
60
60
|
}
|
|
61
61
|
const formatSize = ~~size;
|
|
62
|
-
let rootValue = 1 / config.deviceRatio[designWidth]
|
|
62
|
+
let rootValue = 1 / config.deviceRatio[designWidth];
|
|
63
63
|
switch (config === null || config === void 0 ? void 0 : config.targetUnit) {
|
|
64
64
|
case 'vw':
|
|
65
|
-
rootValue
|
|
65
|
+
rootValue = designWidth / 100;
|
|
66
|
+
break;
|
|
67
|
+
case 'px':
|
|
68
|
+
rootValue *= 2;
|
|
66
69
|
break;
|
|
67
70
|
default:
|
|
68
|
-
|
|
71
|
+
// rem
|
|
72
|
+
rootValue *= baseFontSize * 2;
|
|
69
73
|
}
|
|
70
74
|
let val = formatSize / rootValue;
|
|
71
75
|
if (config.unitPrecision >= 0 && config.unitPrecision <= 100) {
|
|
72
|
-
val
|
|
76
|
+
// Number(val): 0.50000 => 0.5
|
|
77
|
+
val = Number(val.toFixed(config.unitPrecision));
|
|
73
78
|
}
|
|
74
79
|
return val + (config === null || config === void 0 ? void 0 : config.targetUnit);
|
|
75
80
|
};
|
package/dist/api/taro.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taro.js","sources":["../../src/api/taro.ts"],"sourcesContent":["import Taro from '@tarojs/api'\nimport { history } from '@tarojs/router'\nimport { isFunction } from '@tarojs/shared'\n\nimport { getApp, getCurrentInstance, getCurrentPages, navigateBack, navigateTo, nextTick, redirectTo, reLaunch, switchTab } from '../api'\nimport { permanentlyNotSupport } from '../utils'\n\nconst {\n Behavior,\n getEnv,\n ENV_TYPE,\n Link,\n interceptors,\n Current,\n options,\n eventCenter,\n Events,\n preload\n} = Taro as any\n\nconst taro: typeof Taro = {\n // @ts-ignore\n Behavior,\n getEnv,\n ENV_TYPE,\n Link,\n interceptors,\n Current,\n getCurrentInstance,\n options,\n nextTick,\n eventCenter,\n Events,\n preload,\n history,\n navigateBack,\n navigateTo,\n reLaunch,\n redirectTo,\n getCurrentPages,\n switchTab\n}\n\nconst requirePlugin = permanentlyNotSupport('requirePlugin')\n\nfunction getConfig (): Record<string, any> {\n if (this?.pxTransformConfig) return this.pxTransformConfig\n return ((taro as any).config ||= {})\n}\n\nconst initPxTransform = function ({\n designWidth = 750,\n deviceRatio = {\n 640: 2.34 / 2,\n 750: 1,\n 828: 1.81 / 2\n } as TaroGeneral.TDeviceRatio,\n baseFontSize = 20,\n unitPrecision = 5,\n targetUnit = 'rem'\n}) {\n const config = getConfig.call(this)\n config.designWidth = designWidth\n config.deviceRatio = deviceRatio\n config.baseFontSize = baseFontSize\n config.targetUnit = targetUnit\n config.unitPrecision = unitPrecision\n}\n\nconst pxTransform = function (size = 0) {\n const config = getConfig.call(this)\n const baseFontSize = config.baseFontSize || 20\n const designWidth = (((input = 0) => isFunction(config.designWidth)\n ? config.designWidth(input)\n : config.designWidth))(size)\n if (!(designWidth in config.deviceRatio)) {\n throw new Error(`deviceRatio 配置中不存在 ${designWidth} 的设置!`)\n }\n const formatSize = ~~size\n let rootValue = 1 / config.deviceRatio[designWidth]
|
|
1
|
+
{"version":3,"file":"taro.js","sources":["../../src/api/taro.ts"],"sourcesContent":["import Taro from '@tarojs/api'\nimport { history } from '@tarojs/router'\nimport { isFunction } from '@tarojs/shared'\n\nimport { getApp, getCurrentInstance, getCurrentPages, navigateBack, navigateTo, nextTick, redirectTo, reLaunch, switchTab } from '../api'\nimport { permanentlyNotSupport } from '../utils'\n\nconst {\n Behavior,\n getEnv,\n ENV_TYPE,\n Link,\n interceptors,\n Current,\n options,\n eventCenter,\n Events,\n preload\n} = Taro as any\n\nconst taro: typeof Taro = {\n // @ts-ignore\n Behavior,\n getEnv,\n ENV_TYPE,\n Link,\n interceptors,\n Current,\n getCurrentInstance,\n options,\n nextTick,\n eventCenter,\n Events,\n preload,\n history,\n navigateBack,\n navigateTo,\n reLaunch,\n redirectTo,\n getCurrentPages,\n switchTab\n}\n\nconst requirePlugin = permanentlyNotSupport('requirePlugin')\n\nfunction getConfig (): Record<string, any> {\n if (this?.pxTransformConfig) return this.pxTransformConfig\n return ((taro as any).config ||= {})\n}\n\nconst initPxTransform = function ({\n designWidth = 750,\n deviceRatio = {\n 640: 2.34 / 2,\n 750: 1,\n 828: 1.81 / 2\n } as TaroGeneral.TDeviceRatio,\n baseFontSize = 20,\n unitPrecision = 5,\n targetUnit = 'rem'\n}) {\n const config = getConfig.call(this)\n config.designWidth = designWidth\n config.deviceRatio = deviceRatio\n config.baseFontSize = baseFontSize\n config.targetUnit = targetUnit\n config.unitPrecision = unitPrecision\n}\n\nconst pxTransform = function (size = 0) {\n const config = getConfig.call(this)\n const baseFontSize = config.baseFontSize || 20\n const designWidth = (((input = 0) => isFunction(config.designWidth)\n ? config.designWidth(input)\n : config.designWidth))(size)\n if (!(designWidth in config.deviceRatio)) {\n throw new Error(`deviceRatio 配置中不存在 ${designWidth} 的设置!`)\n }\n const formatSize = ~~size\n let rootValue = 1 / config.deviceRatio[designWidth]\n switch (config?.targetUnit) {\n case 'vw':\n rootValue = designWidth / 100\n break\n case 'px':\n rootValue *= 2\n break\n default:\n // rem\n rootValue *= baseFontSize * 2\n }\n let val: number | string = formatSize / rootValue\n if (config.unitPrecision >= 0 && config.unitPrecision <= 100) {\n // Number(val): 0.50000 => 0.5\n val = Number(val.toFixed(config.unitPrecision))\n }\n return val + config?.targetUnit\n}\n\nconst canIUseWebp = function () {\n const canvas = document.createElement('canvas')\n return canvas.toDataURL('image/webp').indexOf('data:image/webp') === 0\n}\n\ntaro.requirePlugin = requirePlugin\ntaro.getApp = getApp\ntaro.pxTransform = pxTransform\ntaro.initPxTransform = initPxTransform\ntaro.canIUseWebp = canIUseWebp\n\nexport default taro\n\nexport {\n Behavior,\n canIUseWebp,\n Current,\n ENV_TYPE,\n eventCenter,\n Events,\n getEnv,\n history,\n initPxTransform,\n interceptors,\n Link,\n options,\n preload,\n pxTransform,\n requirePlugin\n}\n"],"names":[],"mappings":";;;;;;;;;AAOM,MAAA,EACJ,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,YAAY,EACZ,OAAO,EACP,OAAO,EACP,WAAW,EACX,MAAM,EACN,OAAO,EACR,GAAG,KAAW;AAEf,MAAM,IAAI,GAAgB;;IAExB,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,IAAI;IACJ,YAAY;IACZ,OAAO;IACP,kBAAkB;IAClB,OAAO;IACP,QAAQ;IACR,WAAW;IACX,MAAM;IACN,OAAO;IACP,OAAO;IACP,YAAY;IACZ,UAAU;IACV,QAAQ;IACR,UAAU;IACV,eAAe;IACf,SAAS;EACV;AAED,MAAM,aAAa,GAAG,qBAAqB,CAAC,eAAe,EAAC;AAE5D,SAAS,SAAS,GAAA;;AAChB,IAAA,IAAI,IAAI,KAAJ,IAAA,IAAA,IAAI,KAAJ,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,IAAI,CAAE,iBAAiB;QAAE,OAAO,IAAI,CAAC,iBAAiB,CAAA;IAC1D,QAAO,CAAA,EAAA,GAAE,IAAY,EAAC,MAAM,QAAN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background
|
|
3
|
-
export * from "./custom-component
|
|
4
|
-
export * from "./fonts
|
|
5
|
-
export * from "./interaction/index
|
|
6
|
-
export * from "./menu
|
|
7
|
-
export * from "./navigation-bar/index
|
|
8
|
-
export * from "./pull-down-refresh
|
|
9
|
-
export * from "./scroll/index
|
|
10
|
-
export * from "./sticky
|
|
11
|
-
export * from "./tab-bar
|
|
12
|
-
export * from "./window
|
|
1
|
+
export * from "./animation/index";
|
|
2
|
+
export * from "./background";
|
|
3
|
+
export * from "./custom-component";
|
|
4
|
+
export * from "./fonts";
|
|
5
|
+
export * from "./interaction/index";
|
|
6
|
+
export * from "./menu";
|
|
7
|
+
export * from "./navigation-bar/index";
|
|
8
|
+
export * from "./pull-down-refresh";
|
|
9
|
+
export * from "./scroll/index";
|
|
10
|
+
export * from "./sticky";
|
|
11
|
+
export * from "./tab-bar";
|
|
12
|
+
export * from "./window";
|
|
@@ -3,13 +3,6 @@ import { findDOM } from '../../utils/index.js';
|
|
|
3
3
|
// pollify
|
|
4
4
|
import('intersection-observer');
|
|
5
5
|
class TaroH5IntersectionObserver {
|
|
6
|
-
// selector 的容器节点
|
|
7
|
-
get container() {
|
|
8
|
-
const container = (this._component !== null
|
|
9
|
-
? (findDOM(this._component) || document)
|
|
10
|
-
: document);
|
|
11
|
-
return container;
|
|
12
|
-
}
|
|
13
6
|
constructor(component, options = {}) {
|
|
14
7
|
// 选项
|
|
15
8
|
this._options = {
|
|
@@ -26,6 +19,13 @@ class TaroH5IntersectionObserver {
|
|
|
26
19
|
this._component = component;
|
|
27
20
|
Object.assign(this._options, options);
|
|
28
21
|
}
|
|
22
|
+
// selector 的容器节点
|
|
23
|
+
get container() {
|
|
24
|
+
const container = (this._component !== null
|
|
25
|
+
? (findDOM(this._component) || document)
|
|
26
|
+
: document);
|
|
27
|
+
return container;
|
|
28
|
+
}
|
|
29
29
|
createInst() {
|
|
30
30
|
// 去除原本的实例
|
|
31
31
|
this.disconnect();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntersectionObserver.js","sources":["../../../src/api/wxml/IntersectionObserver.ts"],"sourcesContent":["import Taro from '@tarojs/taro'\n\nimport { findDOM } from '../../utils'\n// pollify\nimport('intersection-observer')\n\ntype TElement = Document | HTMLElement | Element\n\ntype TListener = {\n element: Element\n callback: Taro.IntersectionObserver.ObserveCallback\n}\n\nexport class TaroH5IntersectionObserver implements Taro.IntersectionObserver {\n\n // 自定义组件实例\n private _component: TaroGeneral.IAnyObject\n // 选项\n private _options = {\n thresholds: [0],\n initialRatio: 0,\n observeAll: false\n }\n\n // Observer实例\n private _observerInst: IntersectionObserver\n // 监控中的选择器\n private _listeners: TListener[] = []\n // 参照区域\n private _root: Element | null\n // 用来扩展(或收缩)参照节点布局区域的边界\n private _rootMargin: Taro.IntersectionObserver.RelativeToViewportMargins = {}\n // 是否已初始化\n private _isInited = false\n\n // selector 的容器节点\n protected get container () {\n const container: TElement = (\n this._component !== null \n ? (findDOM(this._component) as HTMLElement || document) \n : document\n )\n return container\n }\n\n constructor (component: TaroGeneral.IAnyObject, options: Taro.createIntersectionObserver.Option = {}) {\n this._component = component\n Object.assign(this._options, options)\n }\n\n private createInst () {\n // 去除原本的实例\n this.disconnect()\n\n const { left = 0, top = 0, bottom = 0, right = 0 } = this._rootMargin\n return new IntersectionObserver(entries => {\n entries.forEach(entry => {\n const _callback = this._getCallbackByElement(entry.target)\n const result = {\n boundingClientRect: entry.boundingClientRect,\n intersectionRatio: entry.intersectionRatio,\n intersectionRect: entry.intersectionRect,\n relativeRect: entry.rootBounds || { left: 0, right: 0, top: 0, bottom: 0 },\n time: entry.time\n }\n // web端会默认首次触发\n if (!this._isInited && this._options.initialRatio <= Math.min.apply(Math, this._options.thresholds)) {\n // 初始的相交比例,如果调用时检测到的相交比例与这个值不相等且达到阈值,则会触发一次监听器的回调函数。\n return\n }\n _callback && _callback.call(this, result)\n })\n this._isInited = true\n }, {\n root: this._root,\n rootMargin: [`${top}px`, `${right}px`, `${bottom}px`, `${left}px`].join(' '),\n threshold: this._options.thresholds\n })\n }\n\n public disconnect (): void {\n if (this._observerInst) {\n let listener\n while ((listener = this._listeners.pop())) {\n this._observerInst.unobserve(listener.element)\n }\n this._observerInst.disconnect()\n }\n }\n\n public observe (targetSelector: string, callback: Taro.IntersectionObserver.ObserveCallback): void {\n // 同wx小程序效果一致,每个实例监听一个Selector\n if (this._listeners.length) return\n // 监听前没有设置关联的节点\n if (!this._observerInst) {\n console.warn('Intersection observer will be ignored because no relative nodes are found.')\n return\n }\n \n const nodeList = this._options.observeAll \n ? this.container.querySelectorAll(targetSelector) \n : [this.container.querySelector(targetSelector)]\n \n nodeList.forEach(element => {\n if (!element) return\n this._observerInst.observe(element)\n this._listeners.push({ element, callback })\n })\n }\n\n public relativeTo (selector: string, margins?: Taro.IntersectionObserver.RelativeToMargins | undefined): Taro.IntersectionObserver {\n // 已设置observe监听后,重新关联节点\n if (this._listeners.length) {\n console.error('Relative nodes cannot be added after \"observe\" call in IntersectionObserver')\n return this\n }\n this._root = this.container.querySelector(selector) || null\n if (margins) {\n this._rootMargin = margins\n }\n this._observerInst = this.createInst()\n return this\n }\n\n public relativeToViewport (margins?: Taro.IntersectionObserver.RelativeToViewportMargins | undefined): Taro.IntersectionObserver {\n return this.relativeTo('.taro_page', margins)\n }\n\n private _getCallbackByElement (element: Element) {\n const listener = this._listeners.find(listener => listener.element === element)\n return listener ? listener.callback : null\n }\n\n}\n"],"names":[],"mappings":";;AAGA;AACA,OAAO,uBAAuB,CAAC,CAAA;MASlB,0BAA0B,CAAA
|
|
1
|
+
{"version":3,"file":"IntersectionObserver.js","sources":["../../../src/api/wxml/IntersectionObserver.ts"],"sourcesContent":["import Taro from '@tarojs/taro'\n\nimport { findDOM } from '../../utils'\n// pollify\nimport('intersection-observer')\n\ntype TElement = Document | HTMLElement | Element\n\ntype TListener = {\n element: Element\n callback: Taro.IntersectionObserver.ObserveCallback\n}\n\nexport class TaroH5IntersectionObserver implements Taro.IntersectionObserver {\n\n // 自定义组件实例\n private _component: TaroGeneral.IAnyObject\n // 选项\n private _options = {\n thresholds: [0],\n initialRatio: 0,\n observeAll: false\n }\n\n // Observer实例\n private _observerInst: IntersectionObserver\n // 监控中的选择器\n private _listeners: TListener[] = []\n // 参照区域\n private _root: Element | null\n // 用来扩展(或收缩)参照节点布局区域的边界\n private _rootMargin: Taro.IntersectionObserver.RelativeToViewportMargins = {}\n // 是否已初始化\n private _isInited = false\n\n // selector 的容器节点\n protected get container () {\n const container: TElement = (\n this._component !== null \n ? (findDOM(this._component) as HTMLElement || document) \n : document\n )\n return container\n }\n\n constructor (component: TaroGeneral.IAnyObject, options: Taro.createIntersectionObserver.Option = {}) {\n this._component = component\n Object.assign(this._options, options)\n }\n\n private createInst () {\n // 去除原本的实例\n this.disconnect()\n\n const { left = 0, top = 0, bottom = 0, right = 0 } = this._rootMargin\n return new IntersectionObserver(entries => {\n entries.forEach(entry => {\n const _callback = this._getCallbackByElement(entry.target)\n const result = {\n boundingClientRect: entry.boundingClientRect,\n intersectionRatio: entry.intersectionRatio,\n intersectionRect: entry.intersectionRect,\n relativeRect: entry.rootBounds || { left: 0, right: 0, top: 0, bottom: 0 },\n time: entry.time\n }\n // web端会默认首次触发\n if (!this._isInited && this._options.initialRatio <= Math.min.apply(Math, this._options.thresholds)) {\n // 初始的相交比例,如果调用时检测到的相交比例与这个值不相等且达到阈值,则会触发一次监听器的回调函数。\n return\n }\n _callback && _callback.call(this, result)\n })\n this._isInited = true\n }, {\n root: this._root,\n rootMargin: [`${top}px`, `${right}px`, `${bottom}px`, `${left}px`].join(' '),\n threshold: this._options.thresholds\n })\n }\n\n public disconnect (): void {\n if (this._observerInst) {\n let listener\n while ((listener = this._listeners.pop())) {\n this._observerInst.unobserve(listener.element)\n }\n this._observerInst.disconnect()\n }\n }\n\n public observe (targetSelector: string, callback: Taro.IntersectionObserver.ObserveCallback): void {\n // 同wx小程序效果一致,每个实例监听一个Selector\n if (this._listeners.length) return\n // 监听前没有设置关联的节点\n if (!this._observerInst) {\n console.warn('Intersection observer will be ignored because no relative nodes are found.')\n return\n }\n \n const nodeList = this._options.observeAll \n ? this.container.querySelectorAll(targetSelector) \n : [this.container.querySelector(targetSelector)]\n \n nodeList.forEach(element => {\n if (!element) return\n this._observerInst.observe(element)\n this._listeners.push({ element, callback })\n })\n }\n\n public relativeTo (selector: string, margins?: Taro.IntersectionObserver.RelativeToMargins | undefined): Taro.IntersectionObserver {\n // 已设置observe监听后,重新关联节点\n if (this._listeners.length) {\n console.error('Relative nodes cannot be added after \"observe\" call in IntersectionObserver')\n return this\n }\n this._root = this.container.querySelector(selector) || null\n if (margins) {\n this._rootMargin = margins\n }\n this._observerInst = this.createInst()\n return this\n }\n\n public relativeToViewport (margins?: Taro.IntersectionObserver.RelativeToViewportMargins | undefined): Taro.IntersectionObserver {\n return this.relativeTo('.taro_page', margins)\n }\n\n private _getCallbackByElement (element: Element) {\n const listener = this._listeners.find(listener => listener.element === element)\n return listener ? listener.callback : null\n }\n\n}\n"],"names":[],"mappings":";;AAGA;AACA,OAAO,uBAAuB,CAAC,CAAA;MASlB,0BAA0B,CAAA;IAgCrC,WAAa,CAAA,SAAiC,EAAE,OAAA,GAAkD,EAAE,EAAA;;AA3B5F,QAAA,IAAA,CAAA,QAAQ,GAAG;YACjB,UAAU,EAAE,CAAC,CAAC,CAAC;AACf,YAAA,YAAY,EAAE,CAAC;AACf,YAAA,UAAU,EAAE,KAAK;SAClB,CAAA;;QAKO,IAAU,CAAA,UAAA,GAAgB,EAAE,CAAA;;QAI5B,IAAW,CAAA,WAAA,GAAwD,EAAE,CAAA;;QAErE,IAAS,CAAA,SAAA,GAAG,KAAK,CAAA;AAavB,QAAA,IAAI,CAAC,UAAU,GAAG,SAAS,CAAA;QAC3B,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;KACtC;;AAZD,IAAA,IAAc,SAAS,GAAA;AACrB,QAAA,MAAM,SAAS,IACb,IAAI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;YACnC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAA;AAC7C,SAAC,CAAC,CAAA;KACH;IAEM,UAAU,CAAE,QAAgB,EAAE,OAAiE,EAAA;;AAEpG,QAAA,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE;AAC1B,YAAA,OAAO,CAAC,KAAK,CAAC,6EAA6E,CAAC,CAAA;AAC5F,YAAA,OAAO,IAAI,CAAA;AACZ,SAAA;AACD,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAA;AAC3D,QAAA,IAAI,OAAO,EAAE;AACX,YAAA,IAAI,CAAC,WAAW,GAAG,OAAO,CAAA;AAC3B,SAAA;AACD,QAAA,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,UAAU,EAAE,CAAA;AACtC,QAAA,OAAO,IAAI,CAAA;KACZ;AAEM,IAAA,kBAAkB,CAAE,OAAyE,EAAA;QAClG,OAAO,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,OAAO,CAAC,CAAA;KAC9C;AAEO,IAAA,qBAAqB,CAAE,OAAgB,EAAA;AAC7C,QAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,OAAO,KAAK,OAAO,CAAC,CAAA;QAC/E,OAAO,QAAQ,GAAG,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAAA;KAC3C;AAEF;;;;"}
|
package/dist/index.cjs.d.ts
CHANGED
|
@@ -550,6 +550,7 @@ declare const offLocalServiceFound: (option?: {}, ...args: any[]) => Promise<Par
|
|
|
550
550
|
declare const offLocalServiceDiscoveryStop: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
551
551
|
declare const request: typeof Taro.request;
|
|
552
552
|
declare const addInterceptor: any;
|
|
553
|
+
declare const cleanInterceptors: any;
|
|
553
554
|
// TCP 通信
|
|
554
555
|
declare const createTCPSocket: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
555
556
|
// UDP 通信
|
|
@@ -770,5 +771,5 @@ declare const createWorker: (option?: {}, ...args: any[]) => Promise<Partial<Tar
|
|
|
770
771
|
declare const createSelectorQuery: typeof Taro.createSelectorQuery;
|
|
771
772
|
declare const createIntersectionObserver: typeof Taro.createIntersectionObserver;
|
|
772
773
|
declare const createMediaQueryObserver: typeof Taro.createMediaQueryObserver;
|
|
773
|
-
export { taro as default, taro, createRewardedVideoAd, createInterstitialAd, stopFaceDetect, initFaceDetect, faceDetect, isVKSupport, createVKSession, getOpenUserInfo, env, canIUse, arrayBufferToBase64, base64ToArrayBuffer, getUserCryptoManager, setEnableDebug, getRealtimeLogManager, getLogManager, reportPerformance, getPerformance, openSystemBluetoothSetting, openAppAuthorizeSetting, getWindowInfo, getSystemSetting, getDeviceInfo, getAppBaseInfo, getAppAuthorizeSetting, getSystemInfoSync, getSystemInfoAsync, getSystemInfo, updateWeChatApp, getUpdateManager, onUnhandledRejection, onThemeChange, onPageNotFound, onError, onAudioInterruptionEnd, onAudioInterruptionBegin, onAppShow, onAppHide, offUnhandledRejection, offThemeChange, offPageNotFound, offError, offAudioInterruptionEnd, offAudioInterruptionBegin, offAppShow, offAppHide, getLaunchOptionsSync, getEnterOptionsSync, createOffscreenCanvas, createCanvasContext, canvasToTempFilePath, canvasPutImageData, canvasGetImageData, cloud, reportMonitor, reportAnalytics, reportEvent, getExptInfoSync, stopAccelerometer, startAccelerometer, onAccelerometerChange, offAccelerometerChange, checkIsOpenAccessibility, getBatteryInfoSync, getBatteryInfo, stopBluetoothDevicesDiscovery, startBluetoothDevicesDiscovery, openBluetoothAdapter, onBluetoothDeviceFound, onBluetoothAdapterStateChange, offBluetoothDeviceFound, offBluetoothAdapterStateChange, makeBluetoothPair, isBluetoothDevicePaired, getConnectedBluetoothDevices, getBluetoothDevices, getBluetoothAdapterState, closeBluetoothAdapter, writeBLECharacteristicValue, setBLEMTU, readBLECharacteristicValue, onBLEMTUChange, onBLEConnectionStateChange, onBLECharacteristicValueChange, offBLEMTUChange, offBLEConnectionStateChange, offBLECharacteristicValueChange, notifyBLECharacteristicValueChange, getBLEMTU, getBLEDeviceServices, getBLEDeviceRSSI, getBLEDeviceCharacteristics, createBLEConnection, closeBLEConnection, onBLEPeripheralConnectionStateChanged, offBLEPeripheralConnectionStateChanged, createBLEPeripheralServer, addPhoneRepeatCalendar, addPhoneCalendar, setClipboardData, getClipboardData, stopCompass, startCompass, onCompassChange, offCompassChange, chooseContact, addPhoneContact, getRandomValues, stopGyroscope, startGyroscope, onGyroscopeChange, offGyroscopeChange, stopBeaconDiscovery, startBeaconDiscovery, onBeaconUpdate, onBeaconServiceChange, offBeaconUpdate, offBeaconServiceChange, getBeacons, onKeyboardHeightChange, offKeyboardHeightChange, hideKeyboard, getSelectedTextRange, onMemoryWarning, offMemoryWarning, stopDeviceMotionListening, startDeviceMotionListening, onDeviceMotionChange, offDeviceMotionChange, getNetworkType, onNetworkWeakChange, onNetworkStatusChange, offNetworkWeakChange, offNetworkStatusChange, getLocalIPAddress, stopHCE, startHCE, sendHCEMessage, onHCEMessage, offHCEMessage, getNFCAdapter, getHCEState, makePhoneCall, scanCode, setVisualEffectOnCapture, setScreenBrightness, setKeepScreenOn, onUserCaptureScreen, offUserCaptureScreen, getScreenBrightness, vibrateShort, vibrateLong, stopWifi, startWifi, setWifiList, onWifiConnectedWithPartialInfo, onWifiConnected, onGetWifiList, offWifiConnected, offGetWifiList, getWifiList, getConnectedWifi, connectWifi, getExtConfigSync, getExtConfig, saveFileToDisk, saveFile, removeSavedFile, openDocument, getSavedFileList, getSavedFileInfo, getFileSystemManager, getFileInfo, getApp, getCurrentInstance, stopLocationUpdate, startLocationUpdateBackground, startLocationUpdate, openLocation, onLocationChangeError, onLocationChange, offLocationChangeError, offLocationChange, getLocation, choosePoi, getFuzzyLocation, chooseLocation, stopVoice, setInnerAudioOption, playVoice, pauseVoice, getAvailableAudioSources, createWebAudioContext, createMediaAudioPlayer, createInnerAudioContext, createAudioContext, stopBackgroundAudio, seekBackgroundAudio, playBackgroundAudio, pauseBackgroundAudio, onBackgroundAudioStop, onBackgroundAudioPlay, onBackgroundAudioPause, getBackgroundAudioPlayerState, getBackgroundAudioManager, createCameraContext, saveImageToPhotosAlbum, previewMedia, getImageInfo, previewImage, compressImage, chooseMessageFile, chooseImage, createLivePusherContext, createLivePlayerContext, createMapContext, createMediaRecorder, stopRecord, startRecord, getRecorderManager, saveVideoToPhotosAlbum, openVideoEditor, getVideoInfo, createVideoContext, compressVideo, chooseVideo, chooseMedia, createVideoDecoder, createMediaContainer, updateVoIPChatMuteConfig, subscribeVoIPVideoMembers, setEnable1v1Chat, onVoIPVideoMembersChanged, onVoIPChatStateChanged, onVoIPChatSpeakersChanged, onVoIPChatMembersChanged, onVoIPChatInterrupted, offVoIPVideoMembersChanged, offVoIPChatStateChanged, offVoIPChatMembersChanged, offVoIPChatInterrupted, joinVoIPChat, exitVoIPChat, openEmbeddedMiniProgram, navigateToMiniProgram, navigateBackMiniProgram, exitMiniProgram, openBusinessView, downloadFile, stopLocalServiceDiscovery, startLocalServiceDiscovery, onLocalServiceResolveFail, onLocalServiceLost, onLocalServiceFound, onLocalServiceDiscoveryStop, offLocalServiceResolveFail, offLocalServiceLost, offLocalServiceFound, offLocalServiceDiscoveryStop, request, addInterceptor, createTCPSocket, createUDPSocket, uploadFile, sendSocketMessage, onSocketOpen, onSocketMessage, onSocketError, onSocketClose, connectSocket, closeSocket, getAccountInfoSync, chooseAddress, authorizeForMiniProgram, authorize, openCard, addCard, reserveChannelsLive, openChannelsLive, openChannelsEvent, openChannelsActivity, getChannelsLiveNoticeInfo, getChannelsLiveInfo, openCustomerServiceChat, checkIsSupportFacialRecognition, startFacialRecognitionVerify, startFacialRecognitionVerifyAndUploadVideo, faceVerifyForPay, addVideoToFavorites, addFileToFavorites, checkIsAddedToMyMiniProgram, getGroupEnterInfo, chooseInvoiceTitle, chooseInvoice, chooseLicensePlate, pluginLogin, login, checkSession, showRedPackage, openSetting, getSetting, startSoterAuthentication, checkIsSupportSoterAuthentication, checkIsSoterEnrolledInDevice, requestSubscribeMessage, getUserProfile, getUserInfo, shareToWeRun, getWeRunData, requestPayment, requestOrderPayment, updateShareMenu, showShareMenu, showShareImageMenu, shareVideoMessage, shareFileMessage, onCopyUrl, offCopyUrl, hideShareMenu, getShareInfo, authPrivateMessage, setStorageSync, setStorage, revokeBufferURL, removeStorageSync, removeStorage, getStorageSync, getStorageInfoSync, getStorageInfo, getStorage, createBufferURL, clearStorageSync, clearStorage, setBackgroundFetchToken, onBackgroundFetchData, getBackgroundFetchToken, getBackgroundFetchData, setPageInfo, ocrIdCard, ocrBankCard, ocrDrivingLicense, ocrVehicleLicense, textReview, textToAudio, imageAudit, advancedGeneralIdentify, objectDetectIdentify, carClassify, dishClassify, logoClassify, animalClassify, plantClassify, getSwanId, requestPolymerPayment, navigateToSmartGameProgram, navigateToSmartProgram, navigateBackSmartProgram, preloadSubPackage, createAnimation, setBackgroundTextStyle, setBackgroundColor, nextTick, loadFontFace, disableAlertBeforeUnload, enableAlertBeforeUnload, hideLoading, hideToast, showActionSheet, showLoading, showModal, showToast, getMenuButtonBoundingClientRect, showNavigationBarLoading, setNavigationBarTitle, setNavigationBarColor, hideNavigationBarLoading, hideHomeButton, startPullDownRefresh, stopPullDownRefresh, pageScrollTo, setTopBarText, initTabBarApis, showTabBarRedDot, showTabBar, setTabBarStyle, setTabBarItem, setTabBarBadge, removeTabBarBadge, hideTabBarRedDot, hideTabBar, setWindowSize, onWindowResize, offWindowResize, createWorker, createSelectorQuery, createIntersectionObserver, createMediaQueryObserver, Behavior, canIUseWebp, Current, ENV_TYPE, eventCenter, Events, getEnv, history, initPxTransform, interceptors, Link, options, preload, pxTransform, requirePlugin };
|
|
774
|
+
export { taro as default, taro, createRewardedVideoAd, createInterstitialAd, stopFaceDetect, initFaceDetect, faceDetect, isVKSupport, createVKSession, getOpenUserInfo, env, canIUse, arrayBufferToBase64, base64ToArrayBuffer, getUserCryptoManager, setEnableDebug, getRealtimeLogManager, getLogManager, reportPerformance, getPerformance, openSystemBluetoothSetting, openAppAuthorizeSetting, getWindowInfo, getSystemSetting, getDeviceInfo, getAppBaseInfo, getAppAuthorizeSetting, getSystemInfoSync, getSystemInfoAsync, getSystemInfo, updateWeChatApp, getUpdateManager, onUnhandledRejection, onThemeChange, onPageNotFound, onError, onAudioInterruptionEnd, onAudioInterruptionBegin, onAppShow, onAppHide, offUnhandledRejection, offThemeChange, offPageNotFound, offError, offAudioInterruptionEnd, offAudioInterruptionBegin, offAppShow, offAppHide, getLaunchOptionsSync, getEnterOptionsSync, createOffscreenCanvas, createCanvasContext, canvasToTempFilePath, canvasPutImageData, canvasGetImageData, cloud, reportMonitor, reportAnalytics, reportEvent, getExptInfoSync, stopAccelerometer, startAccelerometer, onAccelerometerChange, offAccelerometerChange, checkIsOpenAccessibility, getBatteryInfoSync, getBatteryInfo, stopBluetoothDevicesDiscovery, startBluetoothDevicesDiscovery, openBluetoothAdapter, onBluetoothDeviceFound, onBluetoothAdapterStateChange, offBluetoothDeviceFound, offBluetoothAdapterStateChange, makeBluetoothPair, isBluetoothDevicePaired, getConnectedBluetoothDevices, getBluetoothDevices, getBluetoothAdapterState, closeBluetoothAdapter, writeBLECharacteristicValue, setBLEMTU, readBLECharacteristicValue, onBLEMTUChange, onBLEConnectionStateChange, onBLECharacteristicValueChange, offBLEMTUChange, offBLEConnectionStateChange, offBLECharacteristicValueChange, notifyBLECharacteristicValueChange, getBLEMTU, getBLEDeviceServices, getBLEDeviceRSSI, getBLEDeviceCharacteristics, createBLEConnection, closeBLEConnection, onBLEPeripheralConnectionStateChanged, offBLEPeripheralConnectionStateChanged, createBLEPeripheralServer, addPhoneRepeatCalendar, addPhoneCalendar, setClipboardData, getClipboardData, stopCompass, startCompass, onCompassChange, offCompassChange, chooseContact, addPhoneContact, getRandomValues, stopGyroscope, startGyroscope, onGyroscopeChange, offGyroscopeChange, stopBeaconDiscovery, startBeaconDiscovery, onBeaconUpdate, onBeaconServiceChange, offBeaconUpdate, offBeaconServiceChange, getBeacons, onKeyboardHeightChange, offKeyboardHeightChange, hideKeyboard, getSelectedTextRange, onMemoryWarning, offMemoryWarning, stopDeviceMotionListening, startDeviceMotionListening, onDeviceMotionChange, offDeviceMotionChange, getNetworkType, onNetworkWeakChange, onNetworkStatusChange, offNetworkWeakChange, offNetworkStatusChange, getLocalIPAddress, stopHCE, startHCE, sendHCEMessage, onHCEMessage, offHCEMessage, getNFCAdapter, getHCEState, makePhoneCall, scanCode, setVisualEffectOnCapture, setScreenBrightness, setKeepScreenOn, onUserCaptureScreen, offUserCaptureScreen, getScreenBrightness, vibrateShort, vibrateLong, stopWifi, startWifi, setWifiList, onWifiConnectedWithPartialInfo, onWifiConnected, onGetWifiList, offWifiConnected, offGetWifiList, getWifiList, getConnectedWifi, connectWifi, getExtConfigSync, getExtConfig, saveFileToDisk, saveFile, removeSavedFile, openDocument, getSavedFileList, getSavedFileInfo, getFileSystemManager, getFileInfo, getApp, getCurrentInstance, stopLocationUpdate, startLocationUpdateBackground, startLocationUpdate, openLocation, onLocationChangeError, onLocationChange, offLocationChangeError, offLocationChange, getLocation, choosePoi, getFuzzyLocation, chooseLocation, stopVoice, setInnerAudioOption, playVoice, pauseVoice, getAvailableAudioSources, createWebAudioContext, createMediaAudioPlayer, createInnerAudioContext, createAudioContext, stopBackgroundAudio, seekBackgroundAudio, playBackgroundAudio, pauseBackgroundAudio, onBackgroundAudioStop, onBackgroundAudioPlay, onBackgroundAudioPause, getBackgroundAudioPlayerState, getBackgroundAudioManager, createCameraContext, saveImageToPhotosAlbum, previewMedia, getImageInfo, previewImage, compressImage, chooseMessageFile, chooseImage, createLivePusherContext, createLivePlayerContext, createMapContext, createMediaRecorder, stopRecord, startRecord, getRecorderManager, saveVideoToPhotosAlbum, openVideoEditor, getVideoInfo, createVideoContext, compressVideo, chooseVideo, chooseMedia, createVideoDecoder, createMediaContainer, updateVoIPChatMuteConfig, subscribeVoIPVideoMembers, setEnable1v1Chat, onVoIPVideoMembersChanged, onVoIPChatStateChanged, onVoIPChatSpeakersChanged, onVoIPChatMembersChanged, onVoIPChatInterrupted, offVoIPVideoMembersChanged, offVoIPChatStateChanged, offVoIPChatMembersChanged, offVoIPChatInterrupted, joinVoIPChat, exitVoIPChat, openEmbeddedMiniProgram, navigateToMiniProgram, navigateBackMiniProgram, exitMiniProgram, openBusinessView, downloadFile, stopLocalServiceDiscovery, startLocalServiceDiscovery, onLocalServiceResolveFail, onLocalServiceLost, onLocalServiceFound, onLocalServiceDiscoveryStop, offLocalServiceResolveFail, offLocalServiceLost, offLocalServiceFound, offLocalServiceDiscoveryStop, request, addInterceptor, cleanInterceptors, createTCPSocket, createUDPSocket, uploadFile, sendSocketMessage, onSocketOpen, onSocketMessage, onSocketError, onSocketClose, connectSocket, closeSocket, getAccountInfoSync, chooseAddress, authorizeForMiniProgram, authorize, openCard, addCard, reserveChannelsLive, openChannelsLive, openChannelsEvent, openChannelsActivity, getChannelsLiveNoticeInfo, getChannelsLiveInfo, openCustomerServiceChat, checkIsSupportFacialRecognition, startFacialRecognitionVerify, startFacialRecognitionVerifyAndUploadVideo, faceVerifyForPay, addVideoToFavorites, addFileToFavorites, checkIsAddedToMyMiniProgram, getGroupEnterInfo, chooseInvoiceTitle, chooseInvoice, chooseLicensePlate, pluginLogin, login, checkSession, showRedPackage, openSetting, getSetting, startSoterAuthentication, checkIsSupportSoterAuthentication, checkIsSoterEnrolledInDevice, requestSubscribeMessage, getUserProfile, getUserInfo, shareToWeRun, getWeRunData, requestPayment, requestOrderPayment, updateShareMenu, showShareMenu, showShareImageMenu, shareVideoMessage, shareFileMessage, onCopyUrl, offCopyUrl, hideShareMenu, getShareInfo, authPrivateMessage, setStorageSync, setStorage, revokeBufferURL, removeStorageSync, removeStorage, getStorageSync, getStorageInfoSync, getStorageInfo, getStorage, createBufferURL, clearStorageSync, clearStorage, setBackgroundFetchToken, onBackgroundFetchData, getBackgroundFetchToken, getBackgroundFetchData, setPageInfo, ocrIdCard, ocrBankCard, ocrDrivingLicense, ocrVehicleLicense, textReview, textToAudio, imageAudit, advancedGeneralIdentify, objectDetectIdentify, carClassify, dishClassify, logoClassify, animalClassify, plantClassify, getSwanId, requestPolymerPayment, navigateToSmartGameProgram, navigateToSmartProgram, navigateBackSmartProgram, preloadSubPackage, createAnimation, setBackgroundTextStyle, setBackgroundColor, nextTick, loadFontFace, disableAlertBeforeUnload, enableAlertBeforeUnload, hideLoading, hideToast, showActionSheet, showLoading, showModal, showToast, getMenuButtonBoundingClientRect, showNavigationBarLoading, setNavigationBarTitle, setNavigationBarColor, hideNavigationBarLoading, hideHomeButton, startPullDownRefresh, stopPullDownRefresh, pageScrollTo, setTopBarText, initTabBarApis, showTabBarRedDot, showTabBar, setTabBarStyle, setTabBarItem, setTabBarBadge, removeTabBarBadge, hideTabBarRedDot, hideTabBar, setWindowSize, onWindowResize, offWindowResize, createWorker, createSelectorQuery, createIntersectionObserver, createMediaQueryObserver, Behavior, canIUseWebp, Current, ENV_TYPE, eventCenter, Events, getEnv, history, initPxTransform, interceptors, Link, options, preload, pxTransform, requirePlugin };
|
|
774
775
|
export { getCurrentPages, navigateBack, navigateTo, redirectTo, reLaunch, switchTab } from "@tarojs/router";
|