@tarojs/taro 3.3.14 → 3.3.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarojs/taro",
3
- "version": "3.3.14",
3
+ "version": "3.3.15",
4
4
  "description": "Taro framework",
5
5
  "homepage": "https://github.com/nervjs/taro/tree/master/packages/taro#readme",
6
6
  "main": "index.js",
@@ -26,9 +26,9 @@
26
26
  "author": "O2Team",
27
27
  "license": "MIT",
28
28
  "dependencies": {
29
- "@tarojs/api": "3.3.14",
30
- "@tarojs/runtime": "3.3.14",
31
- "@tarojs/taro-h5": "3.3.14"
29
+ "@tarojs/api": "3.3.15",
30
+ "@tarojs/runtime": "3.3.15",
31
+ "@tarojs/taro-h5": "3.3.15"
32
32
  },
33
- "gitHead": "ffd2b33c2a760094372a9ec69735ab9c4d1877e5"
33
+ "gitHead": "4a11ab9a8950f6a580e1278c160f6b4aaa8ac4f2"
34
34
  }
@@ -41,6 +41,8 @@ declare module '../../index' {
41
41
  '3g'
42
42
  /** 4g 网络 */
43
43
  '4g'
44
+ /** 5g 网络 */
45
+ '5g'
44
46
  /** Android 下不常见的网络类型 */
45
47
  'unknown'
46
48
  /** 无网络 */
@@ -48,6 +50,23 @@ declare module '../../index' {
48
50
  }
49
51
  }
50
52
 
53
+ namespace getLocalIPAddress {
54
+ interface Option {
55
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
56
+ complete?: (res: TaroGeneral.CallbackResult) => void
57
+ /** 接口调用失败的回调函数 */
58
+ fail?: (res: TaroGeneral.CallbackResult) => void
59
+ /** 接口调用成功的回调函数 */
60
+ success?: (result: SuccessCallbackResult) => void
61
+ }
62
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
63
+ /** 本机局域网IP地址 */
64
+ localip: string
65
+ /** 调用结果 */
66
+ errMsg: string
67
+ }
68
+ }
69
+
51
70
  interface TaroStatic {
52
71
  /** 监听网络状态变化。
53
72
  * @supported weapp, h5, rn
@@ -89,5 +108,18 @@ declare module '../../index' {
89
108
  /** 取消监听网络状态变化事件,参数为空,则取消所有的事件监听 */
90
109
  callback?: (...args: any[]) => any,
91
110
  ): void
111
+
112
+ /** 获取局域网IP地址。
113
+ * @supported weapp
114
+ * @example
115
+ * ```tsx
116
+ * Taro.getLocalIPAddress()
117
+ * .then(res => {
118
+ * const localip = res.localip
119
+ * })
120
+ * ```
121
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.getLocalIPAddress.html
122
+ */
123
+ getLocalIPAddress(option?: getLocalIPAddress.Option): Promise<getLocalIPAddress.SuccessCallbackResult>
92
124
  }
93
125
  }
@@ -39,5 +39,15 @@ declare module '../../index' {
39
39
  /** 内存不足告警事件的回调函数 */
40
40
  callback: onMemoryWarning.Callback,
41
41
  ): void
42
+
43
+ /** 取消监听内存不足告警事件。
44
+ * @supported weapp
45
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/memory/wx.offMemoryWarning.html
46
+ */
47
+ offMemoryWarning(
48
+ /** 取消监听内存不足告警事件 */
49
+ callback: (...args: any[]) => any,
50
+ ): void
51
+
42
52
  }
43
53
  }
package/types/global.d.ts CHANGED
@@ -347,4 +347,44 @@ declare namespace TaroGeneral {
347
347
  extraData: IAnyObject
348
348
  }
349
349
  }
350
+
351
+ // Events
352
+ class Events {
353
+ /**
354
+ * 监听一个事件,接受参数
355
+ */
356
+ on(eventName: string, listener: (...args: any[]) => void): this
357
+
358
+ /**
359
+ * 添加一个事件监听,并在事件触发完成之后移除Callbacks链
360
+ */
361
+ once(eventName: string, listener: (...args: any[]) => void): this
362
+
363
+ /**
364
+ * 取消监听一个事件
365
+ */
366
+ off(eventName: string, listener?: (...args: any[]) => void): this
367
+
368
+ /**
369
+ * 取消监听的所有事件
370
+ */
371
+ off(): this
372
+
373
+ /**
374
+ * 触发一个事件,传参
375
+ */
376
+ trigger(eventName: string, ...args: any[]): boolean
377
+ }
378
+
379
+ // ENV_TYPE
380
+ enum ENV_TYPE {
381
+ WEAPP = 'WEAPP',
382
+ WEB = 'WEB',
383
+ RN = 'RN',
384
+ SWAN = 'SWAN',
385
+ ALIPAY = 'ALIPAY',
386
+ TT = 'TT',
387
+ QQ = 'QQ',
388
+ JD = 'JD'
389
+ }
350
390
  }
@@ -1,51 +1,6 @@
1
1
  import Taro, { Component } from './index'
2
2
 
3
- // Events
4
- export class TaroEvents {
5
- /**
6
- * 监听一个事件,接受参数
7
- */
8
- on(eventName: string, listener: (...args: any[]) => void): this
9
-
10
- /**
11
- * 添加一个事件监听,并在事件触发完成之后移除Callbacks链
12
- */
13
- once(eventName: string, listener: (...args: any[]) => void): this
14
-
15
- /**
16
- * 取消监听一个事件
17
- */
18
- off(eventName: string, listener?: (...args: any[]) => void): this
19
-
20
- /**
21
- * 取消监听的所有事件
22
- */
23
- off(): this
24
-
25
- /**
26
- * 触发一个事件,传参
27
- */
28
- trigger(eventName: string, ...args: any[]): boolean
29
- }
30
-
31
- // ENV_TYPE
32
-
33
- export enum TARO_ENV_TYPE {
34
- WEAPP = 'WEAPP',
35
- WEB = 'WEB',
36
- RN = 'RN',
37
- SWAN = 'SWAN',
38
- ALIPAY = 'ALIPAY',
39
- TT = 'TT',
40
- QQ = 'QQ',
41
- JD = 'JD'
42
- }
43
-
44
3
  declare module './index' {
45
- type Events = TaroEvents
46
-
47
- type ENV_TYPE = TARO_ENV_TYPE
48
-
49
4
  type MessageType = 'info' | 'success' | 'error' | 'warning'
50
5
 
51
6
  interface AtMessageOptions {
@@ -89,9 +44,9 @@ declare module './index' {
89
44
 
90
45
  interface TaroStatic {
91
46
  // eventCenter
92
- eventCenter: TaroEvents
47
+ eventCenter: TaroGeneral.Events
93
48
 
94
- getEnv(): ENV_TYPE
49
+ getEnv(): TaroGeneral.ENV_TYPE
95
50
 
96
51
  render(component: Component | JSX.Element, element: Element | null): any
97
52