@tarojs/plugin-platform-harmony-ets 4.0.0-beta.124 → 4.0.0-beta.126

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.
@@ -8,10 +8,12 @@
8
8
  // ❌ DownloadTask.offHeadersReceived 此接口 ohos 不支持
9
9
 
10
10
  import request from '@ohos.request'
11
- import Taro, { DownloadTask } from '@tarojs/taro'
12
11
 
13
12
  import { callAsyncFail, callAsyncSuccess, validateParams } from '../utils'
14
13
 
14
+ import type Taro from '@tarojs/taro/types'
15
+ import type { DownloadTask } from '@tarojs/taro/types'
16
+
15
17
  interface IDownloadConfigOHOS {
16
18
  url: string
17
19
  header?: any
@@ -9,10 +9,12 @@
9
9
 
10
10
  import request from '@ohos.request'
11
11
  import { isUndefined } from '@tarojs/shared'
12
- import Taro, { UploadTask } from '@tarojs/taro'
13
12
 
14
13
  import { callAsyncFail, callAsyncSuccess, validateParams } from '../utils'
15
14
 
15
+ import type Taro from '@tarojs/taro/types'
16
+ import type { UploadTask } from '@tarojs/taro/types'
17
+
16
18
  interface IOHOSFileType {
17
19
  filename?: string
18
20
  name?: string
@@ -1,10 +1,11 @@
1
1
  import { isFunction } from '@tarojs/shared'
2
2
 
3
+ import type { TFunc } from '@tarojs/runtime'
4
+
3
5
  export interface ICallbackResult {
4
6
  /** 错误信息 */
5
7
  errMsg: string
6
8
  }
7
- type TFunc = (...args: any[]) => any
8
9
 
9
10
  type TCallback<T = Partial<ICallbackResult>> = (res: T) => Promise<void> | void
10
11
  interface IMethodParam<T = Partial<ICallbackResult>> {
@@ -3,15 +3,38 @@ export const context: any = {
3
3
  value: null
4
4
  }
5
5
 
6
+ export const uiContext: any = {
7
+ resolver: null,
8
+ value: null
9
+ }
10
+
6
11
  export const Current: any = {
7
12
  app: null,
8
- uiContext: null,
13
+ get uiContext () {
14
+ return uiContext.value
15
+ },
16
+ set uiContext (e) {
17
+ uiContext.resolver(e)
18
+ },
9
19
  router: {},
10
20
  taro: {},
11
21
  contextPromise: new Promise(resolve => {
12
22
  context.resolver = resolve
13
23
 
14
24
  return resolve
25
+ }).then(e => {
26
+ context.value = e
27
+
28
+ return e
29
+ }),
30
+ uiContextPromise: new Promise(resolve => {
31
+ uiContext.resolver = resolve
32
+
33
+ return resolve
34
+ }).then((e) => {
35
+ uiContext.value = e
36
+
37
+ return e
15
38
  }),
16
39
  createHarmonyElement: null
17
40
  }
@@ -1,11 +1,10 @@
1
+ import { TFunc } from "@tarojs/runtime";
1
2
  import Taro from "@tarojs/taro/types";
2
- import Taro$0 from "@tarojs/taro";
3
3
  declare namespace apis {
4
4
  interface ICallbackResult {
5
5
  /** 错误信息 */
6
6
  errMsg: string;
7
7
  }
8
- type TFunc = (...args: any[]) => any;
9
8
  type TCallback<T = Partial<ICallbackResult>> = (res: T) => Promise<void> | void;
10
9
  interface IMethodParam<T = Partial<ICallbackResult>> {
11
10
  name: string;
@@ -380,7 +379,7 @@ declare namespace apis {
380
379
  const navigateBackMiniProgram: (option?: {}, ...args: any[]) => Promise<Partial<ICallbackResult> & Record<string, unknown> & ICallbackResult>;
381
380
  const exitMiniProgram: (option?: {}, ...args: any[]) => Promise<Partial<ICallbackResult> & Record<string, unknown> & ICallbackResult>;
382
381
  const openBusinessView: (option?: {}, ...args: any[]) => Promise<Partial<ICallbackResult> & Record<string, unknown> & ICallbackResult>;
383
- const downloadFile: typeof Taro$0.downloadFile;
382
+ const downloadFile: typeof Taro.downloadFile;
384
383
  const stopLocalServiceDiscovery: (option?: {}, ...args: any[]) => Promise<Partial<ICallbackResult> & Record<string, unknown> & ICallbackResult>;
385
384
  const startLocalServiceDiscovery: (option?: {}, ...args: any[]) => Promise<Partial<ICallbackResult> & Record<string, unknown> & ICallbackResult>;
386
385
  const onLocalServiceResolveFail: (option?: {}, ...args: any[]) => Promise<Partial<ICallbackResult> & Record<string, unknown> & ICallbackResult>;
@@ -397,7 +396,7 @@ declare namespace apis {
397
396
  const createUDPSocket: (option?: {}, ...args: any[]) => Promise<Partial<ICallbackResult> & Record<string, unknown> & ICallbackResult>;
398
397
  // wx 只支持 HTTP POST 请求,OHOS 支持 POST 和 PUT 请求
399
398
  // OHOS 不支持 wx 的 timeout,但是支持 file 文件列表上传,wx 是单文件上传
400
- const uploadFile: typeof Taro$0.uploadFile;
399
+ const uploadFile: typeof Taro.uploadFile;
401
400
  const connectSocket: typeof Taro.connectSocket;
402
401
  const getAccountInfoSync: (option?: {}, ...args: any[]) => Promise<Partial<ICallbackResult> & Record<string, unknown> & ICallbackResult>;
403
402
  const chooseAddress: (option?: {}, ...args: any[]) => Promise<Partial<ICallbackResult> & Record<string, unknown> & ICallbackResult>;
@@ -581,7 +580,7 @@ declare namespace apis {
581
580
  }
582
581
  const createAnimation: (option: Taro.createAnimation.Option) => Animation;
583
582
  const setBackgroundTextStyle: (option?: {}, ...args: any[]) => Promise<Partial<ICallbackResult> & Record<string, unknown> & ICallbackResult>;
584
- function setBackgroundColor(options: Taro$0.setBackgroundColor.Option): Promise<unknown>;
583
+ function setBackgroundColor(options: Taro.setBackgroundColor.Option): Promise<unknown>;
585
584
  // 自定义组件
586
585
  const nextTick: typeof Taro.nextTick;
587
586
  const loadFontFace: (option?: {}, ...args: any[]) => Promise<Partial<ICallbackResult> & Record<string, unknown> & ICallbackResult>;