@tarojs/plugin-platform-harmony-ets 3.7.0-alpha.27 → 4.0.0-alpha.10
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/apis/apis.ts +6 -2
- package/dist/apis/base/crypto.ts +4 -0
- package/dist/apis/base/debug.ts +5 -0
- package/dist/apis/base/index.ts +9 -1
- package/dist/apis/base/performance.ts +8 -0
- package/dist/apis/base/system.ts +74 -21
- package/dist/apis/base/update.ts +5 -0
- package/dist/apis/base/weapp/app-event.ts +75 -0
- package/dist/apis/base/weapp/life-cycle.ts +21 -0
- package/dist/apis/canvas/index.ts +27 -0
- package/dist/apis/data-analysis/index.ts +6 -0
- package/dist/apis/device/accelerometer.ts +2 -1
- package/dist/apis/device/accessibility.ts +4 -0
- package/dist/apis/device/battery.ts +2 -2
- package/dist/apis/device/bluetooth-ble.ts +19 -0
- package/dist/apis/device/bluetooth-peripheral.ts +6 -0
- package/dist/apis/device/bluetooth.ts +16 -0
- package/dist/apis/device/calendar.ts +5 -0
- package/dist/apis/device/clipboard.ts +17 -9
- package/dist/apis/device/compass.ts +21 -0
- package/dist/apis/device/contact.ts +5 -0
- package/dist/apis/device/crypto.ts +4 -0
- package/dist/apis/device/gyroscope.ts +7 -0
- package/dist/apis/device/iBeacon.ts +10 -0
- package/dist/apis/device/index.ts +15 -0
- package/dist/apis/device/keyboard.ts +2 -1
- package/dist/apis/device/memory.ts +10 -3
- package/dist/apis/device/motion.ts +6 -0
- package/dist/apis/device/network.ts +26 -9
- package/dist/apis/device/nfc.ts +10 -0
- package/dist/apis/device/phone.ts +2 -1
- package/dist/apis/device/scan.ts +4 -0
- package/dist/apis/device/screen.ts +2 -1
- package/dist/apis/device/sms.ts +4 -0
- package/dist/apis/device/vibrate.ts +19 -11
- package/dist/apis/device/wifi.ts +15 -0
- package/dist/apis/ext/index.ts +5 -0
- package/dist/apis/files/index.ts +2 -1
- package/dist/apis/files/manager.ts +2 -1
- package/dist/apis/framework/index.ts +3 -8
- package/dist/apis/index.ts +27 -17
- package/dist/apis/location/index.ts +61 -68
- package/dist/apis/media/EditorContext.ts +32 -0
- package/dist/apis/media/audio/index.ts +18 -0
- package/dist/apis/media/background-audio/index.ts +16 -0
- package/dist/apis/media/camera.ts +16 -0
- package/dist/apis/media/common.ts +2 -1
- package/dist/apis/media/{image.ts → image/index.ts} +4 -3
- package/dist/apis/media/index.ts +10 -0
- package/dist/apis/media/live.ts +5 -0
- package/dist/apis/media/map.ts +4 -0
- package/dist/apis/media/media-recorder.ts +4 -0
- package/dist/apis/media/recorder.ts +6 -0
- package/dist/apis/media/video/VideoContext.ts +68 -0
- package/dist/apis/media/{video.ts → video/index.ts} +13 -2
- package/dist/apis/media/video-decoder.ts +4 -0
- package/dist/apis/media/video-processing.ts +4 -0
- package/dist/apis/media/voip.ts +19 -0
- package/dist/apis/network/index.ts +3 -0
- package/dist/apis/network/mdns.ts +13 -0
- package/dist/apis/network/request.ts +7 -6
- package/dist/apis/network/tcp.ts +4 -0
- package/dist/apis/network/udp.ts +4 -0
- package/dist/apis/network/webSocket.ts +2 -6
- package/dist/apis/open-api/account.ts +4 -0
- package/dist/apis/open-api/address.ts +4 -0
- package/dist/apis/open-api/authorize.ts +5 -0
- package/dist/apis/open-api/card.ts +5 -0
- package/dist/apis/open-api/channels-live.ts +11 -0
- package/dist/apis/open-api/customer-service.ts +4 -0
- package/dist/apis/open-api/device-voip.ts +5 -0
- package/dist/apis/open-api/facial.ts +7 -0
- package/dist/apis/open-api/favorites.ts +5 -0
- package/dist/apis/open-api/group.ts +4 -0
- package/dist/apis/open-api/index.ts +20 -6
- package/dist/apis/open-api/invoice.ts +5 -0
- package/dist/apis/open-api/license-plate.ts +4 -0
- package/dist/apis/open-api/login.ts +6 -0
- package/dist/apis/open-api/my-miniprogram.ts +4 -0
- package/dist/apis/open-api/privacy.ts +7 -0
- package/dist/apis/open-api/red-package.ts +4 -0
- package/dist/apis/open-api/settings.ts +5 -0
- package/dist/apis/open-api/soter.ts +6 -0
- package/dist/apis/open-api/subscribe-message.ts +6 -0
- package/dist/apis/open-api/{user-info/index.ts → user-info.ts} +1 -16
- package/dist/apis/open-api/werun.ts +5 -0
- package/dist/apis/payment/index.ts +6 -0
- package/dist/apis/route/index.ts +19 -28
- package/dist/apis/share/index.ts +33 -0
- package/dist/apis/storage/background-fetch.ts +7 -0
- package/dist/apis/storage/cache-manager.ts +4 -0
- package/dist/apis/storage/index.ts +158 -88
- package/dist/apis/ui/{animation.ts → animation/animation.ts} +73 -31
- package/dist/apis/ui/animation/index.ts +7 -0
- package/dist/apis/ui/background.ts +4 -19
- package/dist/apis/ui/custom-component.ts +8 -0
- package/dist/apis/ui/fonts.ts +4 -0
- package/dist/apis/ui/index.ts +8 -10
- package/dist/apis/ui/interaction/index.ts +45 -59
- package/dist/apis/ui/menu.ts +4 -0
- package/dist/apis/ui/navigation-bar/index.ts +60 -21
- package/dist/apis/ui/pull-down-refresh.ts +10 -4
- package/dist/apis/{page → ui/scroll}/index.ts +32 -27
- package/dist/apis/ui/sticky.ts +4 -0
- package/dist/apis/{tabbar/index.ts → ui/tab-bar.ts} +6 -8
- package/dist/apis/ui/window.ts +20 -0
- package/dist/apis/utils/handler.ts +4 -4
- package/dist/apis/utils/index.ts +1 -1
- package/dist/apis/worker/index.ts +4 -0
- package/dist/apis/wxml/IntersectionObserver.ts +24 -25
- package/dist/apis/wxml/index.ts +7 -2
- package/dist/apis/wxml/nodesRef.ts +2 -2
- package/dist/apis/wxml/selectorQuery.ts +29 -17
- package/dist/components-harmony-ets/button.ets +106 -80
- package/dist/components-harmony-ets/canvas.ets +51 -0
- package/dist/components-harmony-ets/checkbox.ets +82 -148
- package/dist/components-harmony-ets/form.ets +45 -132
- package/dist/components-harmony-ets/icon.ets +66 -69
- package/dist/components-harmony-ets/image.ets +26 -61
- package/dist/components-harmony-ets/index.ets +92 -0
- package/dist/components-harmony-ets/innerHtml.ets +7 -70
- package/dist/components-harmony-ets/input.ets +60 -146
- package/dist/components-harmony-ets/label.ets +86 -92
- package/dist/components-harmony-ets/listView.ets +26 -0
- package/dist/components-harmony-ets/movableArea.ets +124 -0
- package/dist/components-harmony-ets/movableView.ets +93 -0
- package/dist/components-harmony-ets/navigationBar.ets +65 -0
- package/dist/components-harmony-ets/pageMeta.ets +94 -0
- package/dist/components-harmony-ets/picker.ets +172 -198
- package/dist/components-harmony-ets/progress.ets +52 -0
- package/dist/components-harmony-ets/pseudo.ets +80 -0
- package/dist/components-harmony-ets/radio.ets +85 -155
- package/dist/components-harmony-ets/richText.ets +15 -87
- package/dist/components-harmony-ets/scrollList.ets +94 -0
- package/dist/components-harmony-ets/scrollView.ets +81 -149
- package/dist/components-harmony-ets/slider.ets +47 -94
- package/dist/components-harmony-ets/stickySection.ets +42 -0
- package/dist/components-harmony-ets/style.ets +396 -0
- package/dist/components-harmony-ets/swiper.ets +51 -151
- package/dist/components-harmony-ets/switch.ets +35 -76
- package/dist/components-harmony-ets/{index.ts → tag.ts} +6 -0
- package/dist/components-harmony-ets/text.ets +131 -76
- package/dist/components-harmony-ets/textArea.ets +64 -140
- package/dist/components-harmony-ets/utils/AttributeManager.ets +1 -1
- package/dist/components-harmony-ets/utils/DynamicCenter.ts +4 -13
- package/dist/components-harmony-ets/utils/constant/style.ets +9 -6
- package/dist/components-harmony-ets/utils/flexManager.ets +68 -85
- package/dist/components-harmony-ets/utils/helper.ets +18 -65
- package/dist/components-harmony-ets/utils/htmlParser/HarmonyHTMLParser.ts +1 -2
- package/dist/components-harmony-ets/utils/htmlParser/index.ts +1 -1
- package/dist/components-harmony-ets/utils/index.ts +55 -51
- package/dist/components-harmony-ets/utils/styles.ets +177 -65
- package/dist/components-harmony-ets/video.ets +70 -116
- package/dist/components-harmony-ets/view.ets +58 -64
- package/dist/components-harmony-ets/webView.ets +56 -0
- package/dist/index.d.ts +152 -0
- package/dist/index.js +230 -60
- package/dist/index.js.map +1 -1
- package/dist/runtime-ets/bom/document.ts +6 -4
- package/dist/runtime-ets/bom/getComputedStyle.ts +2 -2
- package/dist/runtime-ets/bom/window.ts +9 -2
- package/dist/runtime-ets/current.ts +3 -0
- package/dist/runtime-ets/dom/bind.ts +96 -0
- package/dist/runtime-ets/dom/class-list.ts +4 -6
- package/dist/runtime-ets/dom/comment.ts +1 -2
- package/dist/runtime-ets/dom/cssNesting.ts +409 -0
- package/dist/runtime-ets/dom/cssStyleDeclaration.ts +30 -20
- package/dist/runtime-ets/dom/dataSource.ts +64 -0
- package/dist/runtime-ets/dom/document.ts +36 -51
- package/dist/runtime-ets/dom/element/canvas.ts +136 -0
- package/dist/runtime-ets/dom/element/element.ts +439 -0
- package/dist/runtime-ets/dom/element/form.ts +403 -0
- package/dist/runtime-ets/dom/element/index.ts +120 -0
- package/dist/runtime-ets/dom/element/movableArea.ts +11 -0
- package/dist/runtime-ets/dom/element/movableView.ts +242 -0
- package/dist/runtime-ets/dom/element/normal.ts +103 -0
- package/dist/runtime-ets/dom/element/progress.ts +11 -0
- package/dist/runtime-ets/dom/element/scrollView.ts +15 -0
- package/dist/runtime-ets/dom/element/text.ts +10 -0
- package/dist/runtime-ets/dom/element/video.ts +50 -0
- package/dist/runtime-ets/dom/element/webView.ts +68 -0
- package/dist/runtime-ets/dom/event.ts +26 -5
- package/dist/runtime-ets/dom/eventTarget.ts +3 -3
- package/dist/runtime-ets/dom/node.ts +114 -49
- package/dist/runtime-ets/dom/stylesheet/covertWeb2Hm.ts +805 -0
- package/dist/runtime-ets/dom/stylesheet/index.ts +122 -429
- package/dist/runtime-ets/dom/stylesheet/type.ts +93 -17
- package/dist/runtime-ets/dom/stylesheet/util.ts +145 -17
- package/dist/runtime-ets/index.ts +2 -3
- package/dist/runtime-ets/interface/event.ts +3 -2
- package/dist/runtime-ets/utils/index.ts +87 -17
- package/dist/runtime-ets/utils/info.ts +21 -47
- package/dist/runtime-framework/react/app.ts +20 -28
- package/dist/runtime-framework/react/hooks.ts +3 -4
- package/dist/runtime-framework/react/index.ts +1 -2
- package/dist/runtime-framework/react/native-page.ts +421 -0
- package/dist/runtime-framework/react/page.ts +5 -17
- package/dist/runtime-framework/solid/app.ts +25 -45
- package/dist/runtime-framework/solid/connect.ts +21 -3
- package/dist/runtime-framework/solid/hooks.ts +17 -12
- package/dist/runtime-framework/solid/index.ts +6 -2
- package/dist/runtime-framework/solid/page.ts +84 -36
- package/dist/runtime-framework/solid/reconciler/props.ts +70 -25
- package/dist/runtime-framework/solid/reconciler/render.ts +16 -6
- package/dist/runtime-framework/solid/reconciler/use.ts +0 -1
- package/dist/runtime-framework/solid/utils/index.ts +0 -2
- package/dist/runtime-utils.d.ts +827 -0
- package/dist/runtime-utils.js +1633 -549
- package/dist/runtime-utils.js.map +1 -1
- package/dist/runtime.d.ts +1 -0
- package/dist/runtime.js +1633 -549
- package/dist/runtime.js.map +1 -1
- package/index.js +3 -1
- package/package.json +14 -15
- package/static/media/cancel.svg +1 -0
- package/static/media/circle.svg +1 -0
- package/static/media/clear.svg +1 -0
- package/static/media/download.svg +1 -0
- package/static/media/info.svg +1 -0
- package/static/media/info_circle.svg +1 -0
- package/static/media/search.svg +1 -0
- package/static/media/success.svg +1 -0
- package/static/media/success_no_circle.svg +1 -0
- package/static/media/taro_arrow_left.svg +1 -0
- package/static/media/taro_home.svg +1 -0
- package/static/media/waiting.svg +1 -0
- package/static/media/warn.svg +1 -0
- package/types/harmony.d.ts +4 -0
- package/types/index.d.ts +4 -0
- package/types/runtime.d.ts +7 -1
- package/LICENSE +0 -160
- package/dist/components-harmony-ets/base.ets +0 -63
- package/dist/components-harmony-ets/element.ets +0 -223
- package/dist/components-harmony-ets/utils/constant/icon.ts +0 -19
- package/dist/runtime-ets/dom/element.ts +0 -457
- package/dist/runtime-ets/dom/text.ts +0 -19
- package/dist/runtime-ets/utils/bind.ts +0 -35
- package/types/api.d.ts +0 -4
- /package/dist/runtime-framework/solid/{contant.ts → constant.ts} +0 -0
package/dist/apis/apis.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export * from './base'
|
|
2
|
+
export * from './canvas'
|
|
3
|
+
export * from './data-analysis'
|
|
2
4
|
export * from './device'
|
|
5
|
+
export * from './ext'
|
|
3
6
|
export * from './files'
|
|
4
7
|
export * from './framework'
|
|
5
8
|
export * from './location'
|
|
@@ -7,9 +10,10 @@ export * from './media'
|
|
|
7
10
|
export * from './navigate'
|
|
8
11
|
export * from './network'
|
|
9
12
|
export * from './open-api'
|
|
10
|
-
export * from './
|
|
13
|
+
export * from './payment'
|
|
11
14
|
export * from './route'
|
|
15
|
+
export * from './share'
|
|
12
16
|
export * from './storage'
|
|
13
|
-
export * from './tabbar'
|
|
14
17
|
export * from './ui'
|
|
18
|
+
export * from './worker'
|
|
15
19
|
export * from './wxml'
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { temporarilyNotSupport } from '../utils'
|
|
2
|
+
|
|
3
|
+
export const setEnableDebug = /* @__PURE__ */ temporarilyNotSupport('setEnableDebug')
|
|
4
|
+
export const getRealtimeLogManager = /* @__PURE__ */ temporarilyNotSupport('getRealtimeLogManager')
|
|
5
|
+
export const getLogManager = /* @__PURE__ */ temporarilyNotSupport('getLogManager')
|
package/dist/apis/base/index.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { temporarilyNotSupport } from '../utils'
|
|
2
2
|
|
|
3
|
-
export const
|
|
3
|
+
export const canIUse = /* @__PURE__ */ temporarilyNotSupport('canIUse')
|
|
4
|
+
export const arrayBufferToBase64 = /* @__PURE__ */ temporarilyNotSupport('arrayBufferToBase64')
|
|
5
|
+
export const base64ToArrayBuffer = /* @__PURE__ */ temporarilyNotSupport('base64ToArrayBuffer')
|
|
4
6
|
|
|
7
|
+
export * from './crypto'
|
|
8
|
+
export * from './debug'
|
|
9
|
+
export * from './performance'
|
|
5
10
|
export * from './system'
|
|
11
|
+
export * from './update'
|
|
12
|
+
export * from './weapp/app-event'
|
|
13
|
+
export * from './weapp/life-cycle'
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { temporarilyNotSupport } from '../utils'
|
|
2
|
+
|
|
3
|
+
// 性能
|
|
4
|
+
export const reportPerformance = /* @__PURE__ */ temporarilyNotSupport('reportPerformance')
|
|
5
|
+
export const getPerformance = /* @__PURE__ */ temporarilyNotSupport('getPerformance')
|
|
6
|
+
export const preloadWebview = /* @__PURE__ */ temporarilyNotSupport('preloadWebview')
|
|
7
|
+
export const preloadSkylineView = /* @__PURE__ */ temporarilyNotSupport('preloadSkylineView')
|
|
8
|
+
export const preloadAssets = /* @__PURE__ */ temporarilyNotSupport('preloadAssets')
|
package/dist/apis/base/system.ts
CHANGED
|
@@ -1,26 +1,78 @@
|
|
|
1
|
+
import ConfigurationConstant from '@ohos.app.ability.ConfigurationConstant'
|
|
1
2
|
// 设备信息,从 API Version 6 开始支持
|
|
2
3
|
import deviceInfo from '@ohos.deviceInfo'
|
|
3
4
|
// 显示设备属性,从 API Version 7 开始支持
|
|
4
5
|
import _display from '@ohos.display'
|
|
5
6
|
// 从 API Version 7 开始支持
|
|
6
7
|
import i18n from '@ohos.i18n'
|
|
7
|
-
|
|
8
|
-
import deviceMethod from '@system.device'
|
|
8
|
+
import { Current, window } from '@tarojs/runtime'
|
|
9
9
|
|
|
10
10
|
import { callAsyncFail, callAsyncSuccess } from '../utils'
|
|
11
11
|
|
|
12
|
-
import type Taro from '@tarojs/
|
|
12
|
+
import type Taro from '@tarojs/taro/types'
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
let display
|
|
15
|
+
let navigationIndicatorRect
|
|
16
|
+
let safeArea: TaroGeneral.SafeAreaResult | null = null
|
|
17
|
+
let statusBarHeight
|
|
18
|
+
let windowRect
|
|
15
19
|
|
|
16
|
-
|
|
20
|
+
(Current as any).contextPromise.then((context) => {
|
|
21
|
+
const win = window.__ohos.getLastWindow(context)
|
|
22
|
+
win.then(mainWindow => {
|
|
23
|
+
const topRect = mainWindow.getWindowAvoidArea(window.__ohos.AvoidAreaType.TYPE_SYSTEM).topRect
|
|
24
|
+
navigationIndicatorRect = mainWindow.getWindowAvoidArea(window.__ohos.AvoidAreaType.TYPE_NAVIGATION_INDICATOR).bottomRect
|
|
25
|
+
statusBarHeight = topRect.top + topRect.height
|
|
26
|
+
windowRect = mainWindow.getWindowProperties().windowRect
|
|
17
27
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
28
|
+
try {
|
|
29
|
+
display = _display.getDefaultDisplaySync()
|
|
30
|
+
|
|
31
|
+
setSafeArea({
|
|
32
|
+
top: statusBarHeight,
|
|
33
|
+
left: 0,
|
|
34
|
+
right: display.width,
|
|
35
|
+
bottom: navigationIndicatorRect?.top
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
// @ts-ignore
|
|
39
|
+
display.getCutoutInfo((err, { boundingRects = [], waterfallDisplayAreaRects = {} }: _display.CutoutInfo = {}) => {
|
|
40
|
+
if (err?.code) {
|
|
41
|
+
console.error('Failed to get cutout info', JSON.stringify(err))
|
|
42
|
+
return
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const top = Math.max(...boundingRects.map(rect => rect.top + rect.height), waterfallDisplayAreaRects.top?.top + waterfallDisplayAreaRects.top?.height, statusBarHeight)
|
|
46
|
+
const bottom = Math.min(display.height - waterfallDisplayAreaRects.bottom?.top, navigationIndicatorRect?.top)
|
|
47
|
+
const left = waterfallDisplayAreaRects.left?.left + waterfallDisplayAreaRects.left?.width
|
|
48
|
+
const right = display.width - waterfallDisplayAreaRects.right?.left
|
|
49
|
+
|
|
50
|
+
setSafeArea({
|
|
51
|
+
top,
|
|
52
|
+
left,
|
|
53
|
+
right,
|
|
54
|
+
bottom
|
|
55
|
+
})
|
|
56
|
+
})
|
|
57
|
+
} catch (e) {
|
|
58
|
+
console.error('Failed to get display', e)
|
|
59
|
+
}
|
|
60
|
+
})
|
|
22
61
|
})
|
|
23
62
|
|
|
63
|
+
|
|
64
|
+
function setSafeArea({ top, left, right, bottom }) {
|
|
65
|
+
safeArea = {
|
|
66
|
+
top,
|
|
67
|
+
bottom,
|
|
68
|
+
left,
|
|
69
|
+
right,
|
|
70
|
+
height: bottom - top,
|
|
71
|
+
width: right - left,
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
|
|
24
76
|
/* 同步版本 */
|
|
25
77
|
export const getSystemInfoSync: typeof Taro.getSystemInfoSync = function () {
|
|
26
78
|
const res: any = {}
|
|
@@ -32,7 +84,7 @@ export const getSystemInfoSync: typeof Taro.getSystemInfoSync = function () {
|
|
|
32
84
|
res.cameraAuthorized = null // 允许使用摄像头的开关 boolean
|
|
33
85
|
res.enableDebug = null // 是否已打开调试 boolean
|
|
34
86
|
res.fontSizeSetting = null // 用户字体大小(单位px) number
|
|
35
|
-
res.language = i18n
|
|
87
|
+
res.language = i18n?.getSystemLanguage?.() // string
|
|
36
88
|
res.locationAuthorized = null // 定位的开关 boolean
|
|
37
89
|
res.locationEnabled = null // 地理位置的系统开关 boolean
|
|
38
90
|
res.microphoneAuthorized = null // 麦克风的开关 boolean
|
|
@@ -43,17 +95,18 @@ export const getSystemInfoSync: typeof Taro.getSystemInfoSync = function () {
|
|
|
43
95
|
res.notificationSoundAuthorized = false // 通知带有声音的开关(仅 iOS 有效)boolean
|
|
44
96
|
res.phoneCalendarAuthorized = null // 使用日历的开关 boolean
|
|
45
97
|
res.wifiEnabled = false // Wi-Fi 的系统开关 boolean
|
|
46
|
-
res.pixelRatio =
|
|
47
|
-
res.platform = '
|
|
48
|
-
res.safeArea =
|
|
49
|
-
res.screenHeight = display
|
|
50
|
-
res.screenWidth = display
|
|
51
|
-
res.statusBarHeight =
|
|
52
|
-
res.system = deviceInfo
|
|
53
|
-
|
|
54
|
-
res.
|
|
55
|
-
res.windowHeight =
|
|
56
|
-
res.
|
|
98
|
+
res.pixelRatio = display && display.densityPixels // 设备像素比,number
|
|
99
|
+
res.platform = 'harmony' // 客户端平台 string
|
|
100
|
+
res.safeArea = safeArea // 在竖屏正方向下的安全区域 General.SafeAreaResult
|
|
101
|
+
res.screenHeight = display?.height // 屏幕高度,单位px number
|
|
102
|
+
res.screenWidth = display?.width // 屏幕宽度,单位px number
|
|
103
|
+
res.statusBarHeight = statusBarHeight // 状态栏的高度,单位px number
|
|
104
|
+
res.system = deviceInfo?.osFullName // 操作系统及版本 string
|
|
105
|
+
// Note: 更新配置时才能记录
|
|
106
|
+
res.theme = AppStorage.get('__TARO_APP_CONFIG')?.colorMode === ConfigurationConstant.ColorMode.COLOR_MODE_DARK ? 'dark' : 'light' // 系统当前主题,取值为light或dark 'light' | 'dark'
|
|
107
|
+
res.windowHeight = windowRect?.height // 可使用窗口高度,单位px number
|
|
108
|
+
res.windowWidth = windowRect?.width // 可使用窗口宽度,单位px number
|
|
109
|
+
res.version = deviceInfo?.displayVersion // 版本号 string
|
|
57
110
|
|
|
58
111
|
return res
|
|
59
112
|
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import errorManager from '@ohos.app.ability.errorManager'
|
|
2
|
+
|
|
3
|
+
import { temporarilyNotSupport } from '../../utils'
|
|
4
|
+
import { CallbackManager } from '../../utils/handler'
|
|
5
|
+
|
|
6
|
+
import type Taro from '@tarojs/taro/types'
|
|
7
|
+
|
|
8
|
+
const unhandledRejectionCallbackManager = new CallbackManager<[Taro.onUnhandledRejection.Result]>()
|
|
9
|
+
const errorCallbackManager = new CallbackManager<Parameters<Taro.onError.Callback>>()
|
|
10
|
+
|
|
11
|
+
const unhandledRejectionListener = (res: PromiseRejectionEvent) => {
|
|
12
|
+
unhandledRejectionCallbackManager.trigger(res)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const errorListener = (res: ErrorEvent) => {
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
errorCallbackManager.trigger(res.stack || res.message || res)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// 应用级事件
|
|
21
|
+
export const onUnhandledRejection: typeof Taro.onUnhandledRejection = callback => {
|
|
22
|
+
unhandledRejectionCallbackManager.add(callback)
|
|
23
|
+
if (unhandledRejectionCallbackManager.count() === 1) {
|
|
24
|
+
errorManager.on('error', {
|
|
25
|
+
unhandledRejectionListener
|
|
26
|
+
})
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const onThemeChange = /* @__PURE__ */ temporarilyNotSupport('onThemeChange')
|
|
31
|
+
export const onPageNotFound = /* @__PURE__ */ temporarilyNotSupport('onPageNotFound')
|
|
32
|
+
export const onLazyLoadError = /* @__PURE__ */ temporarilyNotSupport('onLazyLoadError')
|
|
33
|
+
|
|
34
|
+
export const onError: typeof Taro.onError = callback => {
|
|
35
|
+
errorCallbackManager.add(callback)
|
|
36
|
+
if (errorCallbackManager.count() === 1) {
|
|
37
|
+
errorManager.on('error', {
|
|
38
|
+
onException: errorListener
|
|
39
|
+
})
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const onAudioInterruptionEnd = /* @__PURE__ */ temporarilyNotSupport('onAudioInterruptionEnd')
|
|
44
|
+
export const onAudioInterruptionBegin = /* @__PURE__ */ temporarilyNotSupport('onAudioInterruptionBegin')
|
|
45
|
+
|
|
46
|
+
export const onAppShow = /* @__PURE__ */ temporarilyNotSupport('onAppShow')
|
|
47
|
+
export const onAppHide = /* @__PURE__ */ temporarilyNotSupport('onAppHide')
|
|
48
|
+
|
|
49
|
+
export const offUnhandledRejection: typeof Taro.offUnhandledRejection = callback => {
|
|
50
|
+
unhandledRejectionCallbackManager.remove(callback)
|
|
51
|
+
if (unhandledRejectionCallbackManager.count() === 0) {
|
|
52
|
+
errorManager.off('error', {
|
|
53
|
+
unhandledRejectionListener
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export const offThemeChange = /* @__PURE__ */ temporarilyNotSupport('offThemeChange')
|
|
59
|
+
export const offPageNotFound = /* @__PURE__ */ temporarilyNotSupport('offPageNotFound')
|
|
60
|
+
export const offLazyLoadError = /* @__PURE__ */ temporarilyNotSupport('offLazyLoadError')
|
|
61
|
+
|
|
62
|
+
export const offError: typeof Taro.offError = callback => {
|
|
63
|
+
errorCallbackManager.remove(callback)
|
|
64
|
+
if (errorCallbackManager.count() === 0) {
|
|
65
|
+
errorManager.off('error', {
|
|
66
|
+
onException: errorListener
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export const offAudioInterruptionEnd = /* @__PURE__ */ temporarilyNotSupport('offAudioInterruptionEnd')
|
|
72
|
+
export const offAudioInterruptionBegin = /* @__PURE__ */ temporarilyNotSupport('offAudioInterruptionBegin')
|
|
73
|
+
|
|
74
|
+
export const offAppShow = /* @__PURE__ */ temporarilyNotSupport('offAppShow')
|
|
75
|
+
export const offAppHide = /* @__PURE__ */ temporarilyNotSupport('offAppHide')
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { eventCenter } from '@tarojs/runtime/dist/runtime.esm'
|
|
2
|
+
|
|
3
|
+
import type Taro from '@tarojs/taro/types'
|
|
4
|
+
|
|
5
|
+
const launchOptions: Taro.getLaunchOptionsSync.LaunchOptions = {
|
|
6
|
+
path: '',
|
|
7
|
+
query: {},
|
|
8
|
+
scene: 0,
|
|
9
|
+
shareTicket: '',
|
|
10
|
+
referrerInfo: {}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function initLaunchOptions (options = {}) {
|
|
14
|
+
Object.assign(launchOptions, options)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
eventCenter.once('__taroRouterLaunch', initLaunchOptions)
|
|
18
|
+
|
|
19
|
+
// 生命周期
|
|
20
|
+
export const getLaunchOptionsSync: typeof Taro.getLaunchOptionsSync = () => launchOptions
|
|
21
|
+
export const getEnterOptionsSync: typeof Taro.getEnterOptionsSync = () => launchOptions
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { eventSource } from '@tarojs/runtime'
|
|
2
|
+
|
|
3
|
+
import { temporarilyNotSupport } from '../utils'
|
|
4
|
+
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
import type { TaroCanvasElement } from '@tarojs/runtime'
|
|
7
|
+
// 画布
|
|
8
|
+
|
|
9
|
+
/** 创建离屏 canvas 实例 */
|
|
10
|
+
export const createOffscreenCanvas = /* @__PURE__ */ temporarilyNotSupport('createOffscreenCanvas')
|
|
11
|
+
|
|
12
|
+
/** 创建 canvas 的绘图上下文 CanvasContext 对象 */
|
|
13
|
+
// export const createCanvasContext = /* @__PURE__ */ temporarilyNotSupport('createOffscreenCanvas')
|
|
14
|
+
export const createCanvasContext = (canvasId: string) => {
|
|
15
|
+
const dom = eventSource.get(`canvasId-${canvasId}`)
|
|
16
|
+
// return dom as TaroCanvasElement
|
|
17
|
+
if (dom) return (dom as unknown as TaroCanvasElement).context
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** 把当前画布指定区域的内容导出生成指定大小的图片 */
|
|
21
|
+
export const canvasToTempFilePath = /* @__PURE__ */ temporarilyNotSupport('createOffscreenCanvas')
|
|
22
|
+
|
|
23
|
+
/** 将像素数据绘制到画布 */
|
|
24
|
+
export const canvasPutImageData = /* @__PURE__ */ temporarilyNotSupport('createOffscreenCanvas')
|
|
25
|
+
|
|
26
|
+
/** 获取 canvas 区域隐含的像素数据 */
|
|
27
|
+
export const canvasGetImageData = /* @__PURE__ */ temporarilyNotSupport('createOffscreenCanvas')
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { temporarilyNotSupport } from '../utils'
|
|
2
|
+
|
|
3
|
+
export const reportMonitor = /* @__PURE__ */ temporarilyNotSupport('reportMonitor')
|
|
4
|
+
export const reportAnalytics = /* @__PURE__ */ temporarilyNotSupport('reportAnalytics')
|
|
5
|
+
export const reportEvent = /* @__PURE__ */ temporarilyNotSupport('reportEvent')
|
|
6
|
+
export const getExptInfoSync = /* @__PURE__ */ temporarilyNotSupport('getExptInfoSync')
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import sensor from '@ohos.sensor'
|
|
2
|
-
import Taro from '@tarojs/taro'
|
|
3
2
|
|
|
4
3
|
import { CallbackManager, MethodHandler } from '../utils/handler'
|
|
5
4
|
|
|
5
|
+
import type Taro from '@tarojs/taro/types'
|
|
6
|
+
|
|
6
7
|
const callbackManager = new CallbackManager()
|
|
7
8
|
let devicemotionListener
|
|
8
9
|
|
|
@@ -2,7 +2,7 @@ import batteryInfo, { BatteryChargeState } from '@ohos.batteryInfo'
|
|
|
2
2
|
|
|
3
3
|
import { MethodHandler } from '../utils/handler'
|
|
4
4
|
|
|
5
|
-
import type Taro from '@tarojs/
|
|
5
|
+
import type Taro from '@tarojs/taro/types'
|
|
6
6
|
|
|
7
7
|
// 电量
|
|
8
8
|
|
|
@@ -13,7 +13,7 @@ export const getBatteryInfoSync: typeof Taro.getBatteryInfoSync = () => ({
|
|
|
13
13
|
})
|
|
14
14
|
|
|
15
15
|
export const getBatteryInfo: typeof Taro.getBatteryInfo = async ({ success, fail, complete } = {}) => {
|
|
16
|
-
const handle = new MethodHandler({ name: 'getBatteryInfo', success, fail, complete })
|
|
16
|
+
const handle = new MethodHandler<Taro.getBatteryInfo.SuccessCallbackResult>({ name: 'getBatteryInfo', success, fail, complete })
|
|
17
17
|
try {
|
|
18
18
|
return handle.success(getBatteryInfoSync())
|
|
19
19
|
} catch (error) {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { temporarilyNotSupport } from '../utils'
|
|
2
|
+
|
|
3
|
+
// 蓝牙-低功耗中心设备
|
|
4
|
+
export const writeBLECharacteristicValue = /* @__PURE__ */ temporarilyNotSupport('writeBLECharacteristicValue')
|
|
5
|
+
export const setBLEMTU = /* @__PURE__ */ temporarilyNotSupport('setBLEMTU')
|
|
6
|
+
export const readBLECharacteristicValue = /* @__PURE__ */ temporarilyNotSupport('readBLECharacteristicValue')
|
|
7
|
+
export const onBLEMTUChange = /* @__PURE__ */ temporarilyNotSupport('onBLEMTUChange')
|
|
8
|
+
export const onBLEConnectionStateChange = /* @__PURE__ */ temporarilyNotSupport('onBLEConnectionStateChange')
|
|
9
|
+
export const onBLECharacteristicValueChange = /* @__PURE__ */ temporarilyNotSupport('onBLECharacteristicValueChange')
|
|
10
|
+
export const offBLEMTUChange = /* @__PURE__ */ temporarilyNotSupport('offBLEMTUChange')
|
|
11
|
+
export const offBLEConnectionStateChange = /* @__PURE__ */ temporarilyNotSupport('offBLEConnectionStateChange')
|
|
12
|
+
export const offBLECharacteristicValueChange = /* @__PURE__ */ temporarilyNotSupport('offBLECharacteristicValueChange')
|
|
13
|
+
export const notifyBLECharacteristicValueChange = /* @__PURE__ */ temporarilyNotSupport('notifyBLECharacteristicValueChange')
|
|
14
|
+
export const getBLEMTU = /* @__PURE__ */ temporarilyNotSupport('getBLEMTU')
|
|
15
|
+
export const getBLEDeviceServices = /* @__PURE__ */ temporarilyNotSupport('getBLEDeviceServices')
|
|
16
|
+
export const getBLEDeviceRSSI = /* @__PURE__ */ temporarilyNotSupport('getBLEDeviceRSSI')
|
|
17
|
+
export const getBLEDeviceCharacteristics = /* @__PURE__ */ temporarilyNotSupport('getBLEDeviceCharacteristics')
|
|
18
|
+
export const createBLEConnection = /* @__PURE__ */ temporarilyNotSupport('createBLEConnection')
|
|
19
|
+
export const closeBLEConnection = /* @__PURE__ */ temporarilyNotSupport('closeBLEConnection')
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { temporarilyNotSupport } from '../utils'
|
|
2
|
+
|
|
3
|
+
// 蓝牙-低功耗外围设备
|
|
4
|
+
export const onBLEPeripheralConnectionStateChanged = /* @__PURE__ */ temporarilyNotSupport('onBLEPeripheralConnectionStateChanged')
|
|
5
|
+
export const offBLEPeripheralConnectionStateChanged = /* @__PURE__ */ temporarilyNotSupport('offBLEPeripheralConnectionStateChanged')
|
|
6
|
+
export const createBLEPeripheralServer = /* @__PURE__ */ temporarilyNotSupport('createBLEPeripheralServer')
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { temporarilyNotSupport } from '../utils'
|
|
2
|
+
|
|
3
|
+
// 蓝牙-通用
|
|
4
|
+
export const stopBluetoothDevicesDiscovery = /* @__PURE__ */ temporarilyNotSupport('stopBluetoothDevicesDiscovery')
|
|
5
|
+
export const startBluetoothDevicesDiscovery = /* @__PURE__ */ temporarilyNotSupport('startBluetoothDevicesDiscovery')
|
|
6
|
+
export const openBluetoothAdapter = /* @__PURE__ */ temporarilyNotSupport('openBluetoothAdapter')
|
|
7
|
+
export const onBluetoothDeviceFound = /* @__PURE__ */ temporarilyNotSupport('onBluetoothDeviceFound')
|
|
8
|
+
export const onBluetoothAdapterStateChange = /* @__PURE__ */ temporarilyNotSupport('onBluetoothAdapterStateChange')
|
|
9
|
+
export const offBluetoothDeviceFound = /* @__PURE__ */ temporarilyNotSupport('offBluetoothDeviceFound')
|
|
10
|
+
export const offBluetoothAdapterStateChange = /* @__PURE__ */ temporarilyNotSupport('offBluetoothAdapterStateChange')
|
|
11
|
+
export const makeBluetoothPair = /* @__PURE__ */ temporarilyNotSupport('makeBluetoothPair')
|
|
12
|
+
export const isBluetoothDevicePaired = /* @__PURE__ */ temporarilyNotSupport('isBluetoothDevicePaired')
|
|
13
|
+
export const getConnectedBluetoothDevices = /* @__PURE__ */ temporarilyNotSupport('getConnectedBluetoothDevices')
|
|
14
|
+
export const getBluetoothDevices = /* @__PURE__ */ temporarilyNotSupport('getBluetoothDevices')
|
|
15
|
+
export const getBluetoothAdapterState = /* @__PURE__ */ temporarilyNotSupport('getBluetoothAdapterState')
|
|
16
|
+
export const closeBluetoothAdapter = /* @__PURE__ */ temporarilyNotSupport('closeBluetoothAdapter')
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
// 从 API Version 6 开始支持
|
|
2
2
|
import pasteboard from '@ohos.pasteboard'
|
|
3
|
+
import promptAction from '@ohos.promptAction'
|
|
3
4
|
import { isString } from '@tarojs/shared'
|
|
4
5
|
|
|
5
6
|
import { callAsyncFail, getParameterError, object2String } from '../utils'
|
|
6
7
|
import { MethodHandler } from '../utils/handler'
|
|
7
8
|
|
|
8
|
-
import type Taro from '@tarojs/
|
|
9
|
+
import type Taro from '@tarojs/taro/types'
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* 设置系统剪贴板的内容
|
|
@@ -27,9 +28,20 @@ export const setClipboardData: typeof Taro.setClipboardData = function (options)
|
|
|
27
28
|
|
|
28
29
|
return new Promise((resolve, reject) => {
|
|
29
30
|
const systemPasteboard = pasteboard.getSystemPasteboard()
|
|
30
|
-
const pasteData = pasteboard.
|
|
31
|
+
const pasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, data)
|
|
31
32
|
|
|
32
|
-
|
|
33
|
+
try {
|
|
34
|
+
systemPasteboard.setDataSync(pasteData)
|
|
35
|
+
promptAction.showToast({
|
|
36
|
+
message: '内容已复制',
|
|
37
|
+
duration: 1500,
|
|
38
|
+
bottom: '50%',
|
|
39
|
+
showMode: 1 // 设置弹窗显示模式,显示在应用之上。
|
|
40
|
+
})
|
|
41
|
+
return handle.success({
|
|
42
|
+
data,
|
|
43
|
+
}, { resolve, reject })
|
|
44
|
+
} catch (error) {
|
|
33
45
|
if (error) {
|
|
34
46
|
console.error('Failed to set PasteData. Cause: ' + JSON.stringify(error))
|
|
35
47
|
res = {
|
|
@@ -37,12 +49,8 @@ export const setClipboardData: typeof Taro.setClipboardData = function (options)
|
|
|
37
49
|
error: error
|
|
38
50
|
}
|
|
39
51
|
callAsyncFail(reject, res, options)
|
|
40
|
-
} else {
|
|
41
|
-
return handle.success({
|
|
42
|
-
data,
|
|
43
|
-
}, { resolve, reject })
|
|
44
52
|
}
|
|
45
|
-
}
|
|
53
|
+
}
|
|
46
54
|
})
|
|
47
55
|
}
|
|
48
56
|
|
|
@@ -54,7 +62,7 @@ export const getClipboardData: typeof Taro.getClipboardData = function (options)
|
|
|
54
62
|
const handle = new MethodHandler({ name: 'getClipboardData', success, fail, complete })
|
|
55
63
|
return new Promise((resolve, reject) => {
|
|
56
64
|
const systemPasteboard = pasteboard.getSystemPasteboard()
|
|
57
|
-
systemPasteboard.
|
|
65
|
+
systemPasteboard.getData((error, pasteData) => { // callback 形式调用异步接口
|
|
58
66
|
if (error) {
|
|
59
67
|
console.error('Failed to obtain PasteData. Cause: ' + JSON.stringify(error))
|
|
60
68
|
return handle.fail({
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { temporarilyNotSupport } from '../utils'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 停止监听罗盘数据
|
|
5
|
+
*/
|
|
6
|
+
export const stopCompass = temporarilyNotSupport('stopCompass')
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 开始监听罗盘数据
|
|
10
|
+
*/
|
|
11
|
+
export const startCompass = temporarilyNotSupport('startCompass')
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* 监听罗盘数据变化事件。频率:5 次/秒,接口调用后会自动开始监听,可使用 wx.stopCompass 停止监听。
|
|
15
|
+
*/
|
|
16
|
+
export const onCompassChange = temporarilyNotSupport('onCompassChange')
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 取消监听罗盘数据变化事件,参数为空,则取消所有的事件监听。
|
|
20
|
+
*/
|
|
21
|
+
export const offCompassChange = temporarilyNotSupport('offCompassChange')
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { temporarilyNotSupport } from '../utils'
|
|
2
|
+
|
|
3
|
+
// 陀螺仪
|
|
4
|
+
export const stopGyroscope = /* @__PURE__ */ temporarilyNotSupport('stopGyroscope')
|
|
5
|
+
export const startGyroscope = /* @__PURE__ */ temporarilyNotSupport('startGyroscope')
|
|
6
|
+
export const onGyroscopeChange = /* @__PURE__ */ temporarilyNotSupport('onGyroscopeChange')
|
|
7
|
+
export const offGyroscopeChange = /* @__PURE__ */ temporarilyNotSupport('offGyroscopeChange')
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { temporarilyNotSupport } from '../utils'
|
|
2
|
+
|
|
3
|
+
// 蓝牙-信标(Beacon)
|
|
4
|
+
export const stopBeaconDiscovery = /* @__PURE__ */ temporarilyNotSupport('stopBeaconDiscovery')
|
|
5
|
+
export const startBeaconDiscovery = /* @__PURE__ */ temporarilyNotSupport('startBeaconDiscovery')
|
|
6
|
+
export const onBeaconUpdate = /* @__PURE__ */ temporarilyNotSupport('onBeaconUpdate')
|
|
7
|
+
export const onBeaconServiceChange = /* @__PURE__ */ temporarilyNotSupport('onBeaconServiceChange')
|
|
8
|
+
export const offBeaconUpdate = /* @__PURE__ */ temporarilyNotSupport('offBeaconUpdate')
|
|
9
|
+
export const offBeaconServiceChange = /* @__PURE__ */ temporarilyNotSupport('offBeaconServiceChange')
|
|
10
|
+
export const getBeacons = /* @__PURE__ */ temporarilyNotSupport('getBeacons')
|
|
@@ -1,9 +1,24 @@
|
|
|
1
1
|
export * from './accelerometer'
|
|
2
|
+
export * from './accessibility'
|
|
2
3
|
export * from './battery'
|
|
4
|
+
export * from './bluetooth'
|
|
5
|
+
export * from './bluetooth-ble'
|
|
6
|
+
export * from './bluetooth-peripheral'
|
|
7
|
+
export * from './calendar'
|
|
3
8
|
export * from './clipboard'
|
|
9
|
+
export * from './compass'
|
|
10
|
+
export * from './contact'
|
|
11
|
+
export * from './crypto'
|
|
12
|
+
export * from './gyroscope'
|
|
13
|
+
export * from './iBeacon'
|
|
4
14
|
export * from './keyboard'
|
|
5
15
|
export * from './memory'
|
|
16
|
+
export * from './motion'
|
|
6
17
|
export * from './network'
|
|
18
|
+
export * from './nfc'
|
|
7
19
|
export * from './phone'
|
|
20
|
+
export * from './scan'
|
|
8
21
|
export * from './screen'
|
|
22
|
+
export * from './sms'
|
|
9
23
|
export * from './vibrate'
|
|
24
|
+
export * from './wifi'
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import inputMethodEngine from '@ohos.inputMethodEngine'
|
|
2
2
|
import { Current, window } from '@tarojs/runtime'
|
|
3
|
-
import Taro from '@tarojs/taro'
|
|
4
3
|
|
|
5
4
|
import { temporarilyNotSupport } from '../utils'
|
|
6
5
|
import { CallbackManager, MethodHandler } from '../utils/handler'
|
|
7
6
|
|
|
7
|
+
import type Taro from '@tarojs/taro/types'
|
|
8
|
+
|
|
8
9
|
const callbackManager = new CallbackManager()
|
|
9
10
|
|
|
10
11
|
const resizeListener = (height) => {
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { hooks } from '@tarojs/runtime'
|
|
2
2
|
|
|
3
|
-
export const onMemoryWarning =
|
|
4
|
-
|
|
3
|
+
export const onMemoryWarning = (listener) => {
|
|
4
|
+
hooks.tap('getMemoryLevel', (res) => {
|
|
5
|
+
listener(res)
|
|
6
|
+
})
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const offMemoryWarning = (listener) => {
|
|
10
|
+
hooks.off('getMemoryLevel', listener)
|
|
11
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { temporarilyNotSupport } from '../utils'
|
|
2
|
+
|
|
3
|
+
export const stopDeviceMotionListening = temporarilyNotSupport('stopDeviceMotionListening')
|
|
4
|
+
export const startDeviceMotionListening = temporarilyNotSupport('startDeviceMotionListening')
|
|
5
|
+
export const onDeviceMotionChange = temporarilyNotSupport('onDeviceMotionChange')
|
|
6
|
+
export const offDeviceMotionChange = temporarilyNotSupport('offDeviceMotionChange')
|