@doubao-apps/ai 0.0.33 → 0.0.34

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.
Files changed (69) hide show
  1. package/README.md +1 -32
  2. package/dist/733.js +7 -15
  3. package/dist/cli.js +1 -1
  4. package/dist/manifest.json +3 -11
  5. package/dist/skills/doubao-apps-dev/SKILL.md +103 -227
  6. package/dist/skills/doubao-apps-dev/references/examples/common-patterns.md +80 -66
  7. package/dist/skills/doubao-apps-dev/references/examples/component-basics.md +24 -3
  8. package/dist/skills/doubao-apps-dev/references/examples/component-recipes.md +71 -0
  9. package/dist/skills/doubao-apps-dev/references/examples/open-api-recipes.md +203 -0
  10. package/dist/skills/doubao-apps-dev/references/guides/component-development.md +66 -42
  11. package/dist/skills/doubao-apps-dev/references/guides/expired-widget.md +113 -0
  12. package/dist/skills/doubao-apps-dev/references/guides/mcp-ui.md +275 -0
  13. package/dist/skills/doubao-apps-dev/references/guides/performance-optimization.md +24 -7
  14. package/dist/skills/doubao-apps-dev/references/reference/components-quick-ref.md +18 -7
  15. package/dist/skills/doubao-apps-dev/references/reference/framework-api-quick-ref.md +125 -107
  16. package/dist/skills/doubao-apps-dev/references/reference/open-api/01-/345/237/272/347/241/200.md +136 -0
  17. package/dist/skills/doubao-apps-dev/references/reference/open-api/02-/347/263/273/347/273/237.md +257 -0
  18. package/dist/skills/doubao-apps-dev/references/reference/open-api/03-/345/256/232/344/275/215.md +326 -0
  19. package/dist/skills/doubao-apps-dev/references/reference/open-api/04-/345/255/230/345/202/250.md +284 -0
  20. package/dist/skills/doubao-apps-dev/references/reference/open-api/05-/350/267/257/347/224/261.md +162 -0
  21. package/dist/skills/doubao-apps-dev/references/reference/open-api/06-/344/272/244/344/272/222.md +290 -0
  22. package/dist/skills/doubao-apps-dev/references/reference/open-api/07-/350/276/223/345/205/245.md +63 -0
  23. package/dist/skills/doubao-apps-dev/references/reference/open-api/08-/347/275/221/347/273/234.md +124 -0
  24. package/dist/skills/doubao-apps-dev/references/reference/open-api/09-/345/252/222/344/275/223.md +192 -0
  25. package/dist/skills/doubao-apps-dev/references/reference/open-api/10-/344/270/232/345/212/241/350/203/275/345/212/233.md +431 -0
  26. package/dist/skills/doubao-apps-dev/references/reference/open-api/11-/347/231/273/345/275/225.md +110 -0
  27. package/dist/skills/doubao-apps-dev/references/reference/open-api/12-/346/224/257/344/273/230.md +224 -0
  28. package/dist/skills/doubao-apps-dev/references/reference/open-api/13-/346/225/260/346/215/256/345/210/206/346/236/220.md +43 -0
  29. package/dist/skills/doubao-apps-dev/references/reference/open-api/14-/350/223/235/347/211/231.md +598 -0
  30. package/dist/skills/doubao-apps-dev/references/reference/open-api/15-wi-fi.md +210 -0
  31. package/dist/skills/doubao-apps-dev/references/reference/open-api/16-/345/212/240/351/200/237/345/272/246/350/256/241.md +87 -0
  32. package/dist/skills/doubao-apps-dev/references/reference/open-api/17-ibeacon.md +97 -0
  33. package/dist/skills/doubao-apps-dev/references/reference/open-api/18-/347/275/227/347/233/230.md +78 -0
  34. package/dist/skills/doubao-apps-dev/references/reference/open-api/19-/350/256/276/345/244/207/346/226/271/345/220/221.md +86 -0
  35. package/dist/skills/doubao-apps-dev/references/reference/open-api/20-/351/231/200/350/236/272/344/273/252.md +87 -0
  36. package/dist/skills/doubao-apps-dev/references/reference/open-api/21-/350/256/276/345/244/207-/347/275/221/347/273/234.md +102 -0
  37. package/dist/skills/doubao-apps-dev/references/reference/open-api/22-/347/237/255/344/277/241.md +40 -0
  38. package/dist/skills/doubao-apps-dev/references/reference/open-api/23-/346/227/240/351/232/234/347/242/215.md +40 -0
  39. package/dist/skills/doubao-apps-dev/references/reference/open-api/24-/345/237/272/347/241/200/344/277/241/346/201/257.md +86 -0
  40. package/dist/skills/doubao-apps-dev/references/reference/open-api/25-/347/224/265/346/261/240.md +63 -0
  41. package/dist/skills/doubao-apps-dev/references/reference/open-api/26-/346/227/245/345/216/206.md +95 -0
  42. package/dist/skills/doubao-apps-dev/references/reference/open-api/27-/345/211/252/350/264/264/346/235/277.md +64 -0
  43. package/dist/skills/doubao-apps-dev/references/reference/open-api/28-/350/201/224/347/263/273/344/272/272.md +101 -0
  44. package/dist/skills/doubao-apps-dev/references/reference/open-api/29-/345/212/240/345/257/206.md +43 -0
  45. package/dist/skills/doubao-apps-dev/references/reference/open-api/30-/347/224/265/350/257/235.md +36 -0
  46. package/dist/skills/doubao-apps-dev/references/reference/open-api/31-/346/211/253/347/240/201.md +58 -0
  47. package/dist/skills/doubao-apps-dev/references/reference/open-api/32-/345/261/217/345/271/225.md +136 -0
  48. package/dist/skills/doubao-apps-dev/references/reference/open-api/33-/351/234/207/345/212/250.md +62 -0
  49. package/dist/skills/doubao-apps-dev/references/reference/open-api/34-/346/226/207/344/273/266/347/263/273/347/273/237.md +73 -0
  50. package/dist/skills/doubao-apps-dev/references/reference/open-api/README.md +34 -0
  51. package/dist/skills/doubao-apps-dev/references/reference/open-api.md +384 -2
  52. package/dist/skills/doubao-apps-dev/references/rules/dos-and-donts.md +44 -27
  53. package/dist/skills/h5-to-doubao/SKILL.md +8 -4
  54. package/dist/skills/weixin-to-doubao/SKILL.md +8 -4
  55. package/dist/skills/weixin-to-doubao/assets/migration-checklist-template.md +1 -1
  56. package/package.json +2 -3
  57. package/dist/contexts/doubao-apps-dev/AGENTS.md +0 -300
  58. package/dist/contexts/doubao-apps-dev/CLAUDE.md +0 -31
  59. package/dist/contexts/doubao-apps-dev/references/examples/common-patterns.md +0 -589
  60. package/dist/contexts/doubao-apps-dev/references/examples/component-basics.md +0 -526
  61. package/dist/contexts/doubao-apps-dev/references/guides/best-practices.md +0 -571
  62. package/dist/contexts/doubao-apps-dev/references/guides/component-development.md +0 -891
  63. package/dist/contexts/doubao-apps-dev/references/guides/performance-optimization.md +0 -402
  64. package/dist/contexts/doubao-apps-dev/references/guides/troubleshooting.md +0 -287
  65. package/dist/contexts/doubao-apps-dev/references/reference/components-quick-ref.md +0 -103
  66. package/dist/contexts/doubao-apps-dev/references/reference/framework-api-quick-ref.md +0 -550
  67. package/dist/contexts/doubao-apps-dev/references/reference/open-api/README.md +0 -8
  68. package/dist/contexts/doubao-apps-dev/references/reference/open-api.md +0 -11
  69. package/dist/contexts/doubao-apps-dev/references/rules/dos-and-donts.md +0 -467
@@ -0,0 +1,210 @@
1
+ # Open API: Wi-Fi
2
+
3
+ Wi-Fi 模块能力;通常先 startWifi,再获取列表或连接。
4
+
5
+ [返回目录](./README.md) | [返回速查](../open-api.md)
6
+
7
+ ## 速查
8
+
9
+ | API | 说明 |
10
+ | --- | --- |
11
+ | [WifiConnectedListener](#wificonnectedlistener) | Wi-Fi 连接事件监听函数。<br><br>返回 void,不是 Promise。 |
12
+ | [startWifi](#startwifi) | 初始化 Wi-Fi 模块。 |
13
+ | [stopWifi](#stopwifi) | 关闭 Wi-Fi 模块。 |
14
+ | [setWifiList](#setwifilist) | 设置 Wi-Fi 预设列表(iOS 特有)。 |
15
+ | [connectWifi](#connectwifi) | 连接指定 Wi-Fi。 |
16
+ | [getConnectedWifi](#getconnectedwifi) | 获取当前已连接 Wi-Fi 信息。 |
17
+ | [getWifiList](#getwifilist) | 获取 Wi-Fi 列表。 |
18
+
19
+ ## API 详情
20
+
21
+ <a id="wificonnectedlistener"></a>
22
+ ### WifiConnectedListener()
23
+
24
+ Wi-Fi 连接事件监听函数。
25
+
26
+ ## 代码示例
27
+
28
+ ```typescript
29
+ // 暂无代码示例
30
+ ```
31
+
32
+ ## 入参
33
+
34
+ |参数名|类型|必填|说明|
35
+ |---|---|---|---|
36
+ |wifi|`WifiInfo`|是|已连接的 Wi-Fi 信息。|
37
+ |wifi.bssid|`string`|否|Wi-Fi BSSID。|
38
+ |wifi.frequency|`number`|否|频段,单位 MHz。|
39
+ |wifi.secure|`boolean`|否|Wi-Fi 是否安全。|
40
+ |wifi.signalStrength|`number`|否|信号强度。|
41
+ |wifi.ssid|`string`|是|Wi-Fi SSID。|
42
+
43
+ ## 返回值
44
+
45
+ 返回 `void`。
46
+
47
+ <a id="startwifi"></a>
48
+ ### startWifi()
49
+
50
+ 初始化 Wi-Fi 模块。
51
+
52
+ ## 代码示例
53
+
54
+ ```typescript
55
+ import { startWifi } from '@doubao-apps/framework/api';
56
+
57
+ await startWifi();
58
+ ```
59
+
60
+ ## 入参
61
+
62
+ 无入参。
63
+
64
+ ## 返回值
65
+
66
+ 返回 `Promise<object>`。
67
+
68
+ <a id="stopwifi"></a>
69
+ ### stopWifi()
70
+
71
+ 关闭 Wi-Fi 模块。
72
+
73
+ ## 代码示例
74
+
75
+ ```typescript
76
+ import { stopWifi } from '@doubao-apps/framework/api';
77
+
78
+ await stopWifi();
79
+ ```
80
+
81
+ ## 入参
82
+
83
+ 无入参。
84
+
85
+ ## 返回值
86
+
87
+ 返回 `Promise<object>`。
88
+
89
+ <a id="setwifilist"></a>
90
+ ### setWifiList()
91
+
92
+ 设置 Wi-Fi 预设列表(iOS 特有)。
93
+
94
+ ## 代码示例
95
+
96
+ ```typescript
97
+ import { setWifiList } from '@doubao-apps/framework/api';
98
+
99
+ await setWifiList({
100
+ wifiList: [{ ssid: 'Office-WiFi', password: 'password' }]
101
+ });
102
+ ```
103
+
104
+ ## 入参
105
+
106
+ |参数名|类型|必填|说明|
107
+ |---|---|---|---|
108
+ |wifiList|`WifiListItem[]`|是|预设的 Wi-Fi 列表。|
109
+ |wifiList[].bssid|`string`|否|Wi-Fi BSSID。|
110
+ |wifiList[].password|`string`|否|Wi-Fi 密码。|
111
+ |wifiList[].ssid|`string`|否|Wi-Fi SSID。|
112
+
113
+ ## 返回值
114
+
115
+ 返回 `Promise<object>`。
116
+
117
+ <a id="connectwifi"></a>
118
+ ### connectWifi()
119
+
120
+ 连接指定 Wi-Fi。
121
+
122
+ ## 代码示例
123
+
124
+ ```typescript
125
+ import { connectWifi, startWifi } from '@doubao-apps/framework/api';
126
+
127
+ await startWifi();
128
+ await connectWifi({ ssid: 'Office-WiFi', password: 'password' });
129
+ ```
130
+
131
+ ## 入参
132
+
133
+ |参数名|类型|必填|说明|
134
+ |---|---|---|---|
135
+ |bssid|`string`|否|Wi-Fi BSSID。|
136
+ |manual|`boolean`|否|是否跳转到系统设置页连接。|
137
+ |partialInfo|`boolean`|否|是否仅返回部分 Wi-Fi 信息。|
138
+ |password|`string`|是|Wi-Fi 密码。|
139
+ |ssid|`string`|是|Wi-Fi SSID。|
140
+
141
+ ## 返回值
142
+
143
+ 返回 `Promise<object>`。
144
+
145
+ <a id="getconnectedwifi"></a>
146
+ ### getConnectedWifi()
147
+
148
+ 获取当前已连接 Wi-Fi 信息。
149
+
150
+ ## 代码示例
151
+
152
+ ```typescript
153
+ import { getConnectedWifi } from '@doubao-apps/framework/api';
154
+
155
+ const { wifi } = await getConnectedWifi({ partialInfo: true });
156
+
157
+ console.log(wifi.ssid);
158
+ ```
159
+
160
+ ## 入参
161
+
162
+ |参数名|类型|必填|说明|
163
+ |---|---|---|---|
164
+ |partialInfo|`boolean`|否|是否只返回部分 Wi-Fi 信息。|
165
+
166
+ ## 返回值
167
+
168
+ 返回 `Promise<GetConnectedWifiResult>`。
169
+
170
+ |字段名|类型|说明|
171
+ |---|---|---|
172
+ |wifi|`WifiInfo`|当前连接的 Wi-Fi 信息。|
173
+ |wifi.bssid|`string`|Wi-Fi BSSID。|
174
+ |wifi.frequency|`number`|频段,单位 MHz。|
175
+ |wifi.secure|`boolean`|Wi-Fi 是否安全。|
176
+ |wifi.signalStrength|`number`|信号强度。|
177
+ |wifi.ssid|`string`|Wi-Fi SSID。|
178
+
179
+ <a id="getwifilist"></a>
180
+ ### getWifiList()
181
+
182
+ 获取 Wi-Fi 列表。
183
+
184
+ ## 代码示例
185
+
186
+ ```typescript
187
+ import { getWifiList, startWifi } from '@doubao-apps/framework/api';
188
+
189
+ await startWifi();
190
+ const { wifiList } = await getWifiList();
191
+
192
+ console.log(wifiList.map((wifi) => wifi.ssid));
193
+ ```
194
+
195
+ ## 入参
196
+
197
+ 无入参。
198
+
199
+ ## 返回值
200
+
201
+ 返回 `Promise<GetWifiListResult>`。
202
+
203
+ |字段名|类型|说明|
204
+ |---|---|---|
205
+ |wifiList|`WifiInfo[]`|当前获取到的 Wi-Fi 列表。|
206
+ |wifiList[].bssid|`string`|Wi-Fi BSSID。|
207
+ |wifiList[].frequency|`number`|频段,单位 MHz。|
208
+ |wifiList[].secure|`boolean`|Wi-Fi 是否安全。|
209
+ |wifiList[].signalStrength|`number`|信号强度。|
210
+ |wifiList[].ssid|`string`|Wi-Fi SSID。|
@@ -0,0 +1,87 @@
1
+ # Open API: 加速度计
2
+
3
+ 加速度计监听能力。
4
+
5
+ [返回目录](./README.md) | [返回速查](../open-api.md)
6
+
7
+ ## 速查
8
+
9
+ | API | 说明 |
10
+ | --- | --- |
11
+ | [AccelerometerChangeListener](#accelerometerchangelistener) | 加速度数据变化事件监听函数。<br><br>返回 void,不是 Promise。 |
12
+ | [startAccelerometer](#startaccelerometer) | 开始监听加速度。 |
13
+ | [stopAccelerometer](#stopaccelerometer) | 停止监听加速度。 |
14
+
15
+ ## API 详情
16
+
17
+ <a id="accelerometerchangelistener"></a>
18
+ ### AccelerometerChangeListener()
19
+
20
+ 加速度数据变化事件监听函数。
21
+
22
+ ## 代码示例
23
+
24
+ ```typescript
25
+ // 暂无代码示例
26
+ ```
27
+
28
+ ## 入参
29
+
30
+ |参数名|类型|必填|说明|
31
+ |---|---|---|---|
32
+ |timestamp|`number`|是|数据采集时间戳,单位纳秒。|
33
+ |x|`number`|是|X 轴加速度,单位 m/s²。|
34
+ |y|`number`|是|Y 轴加速度,单位 m/s²。|
35
+ |z|`number`|是|Z 轴加速度,单位 m/s²。|
36
+
37
+ ## 返回值
38
+
39
+ 返回 `void`。
40
+
41
+ <a id="startaccelerometer"></a>
42
+ ### startAccelerometer()
43
+
44
+ 开始监听加速度。
45
+
46
+ ## 代码示例
47
+
48
+ ```typescript
49
+ import { startAccelerometer } from '@doubao-apps/framework/api';
50
+
51
+ await startAccelerometer({ interval: 'normal' });
52
+ ```
53
+
54
+ ## 入参
55
+
56
+ |参数名|类型|必填|说明|
57
+ |---|---|---|---|
58
+ |interval|`SensorInterval`|否|监听频率。|
59
+
60
+ **类型说明**
61
+
62
+ - `SensorInterval`: `"game" | "ui" | "normal"`
63
+
64
+ ## 返回值
65
+
66
+ 返回 `Promise<object>`。
67
+
68
+ <a id="stopaccelerometer"></a>
69
+ ### stopAccelerometer()
70
+
71
+ 停止监听加速度。
72
+
73
+ ## 代码示例
74
+
75
+ ```typescript
76
+ import { stopAccelerometer } from '@doubao-apps/framework/api';
77
+
78
+ await stopAccelerometer();
79
+ ```
80
+
81
+ ## 入参
82
+
83
+ 无入参。
84
+
85
+ ## 返回值
86
+
87
+ 返回 `Promise<object>`。
@@ -0,0 +1,97 @@
1
+ # Open API: iBeacon
2
+
3
+ iBeacon 搜索和结果读取能力。
4
+
5
+ [返回目录](./README.md) | [返回速查](../open-api.md)
6
+
7
+ ## 速查
8
+
9
+ | API | 说明 |
10
+ | --- | --- |
11
+ | [startBeaconDiscovery](#startbeacondiscovery) | 开始搜索附近的 iBeacon。 |
12
+ | [stopBeaconDiscovery](#stopbeacondiscovery) | 停止搜索附近的 iBeacon。 |
13
+ | [getBeacons](#getbeacons) | 获取已搜索到的 iBeacon 列表。 |
14
+
15
+ ## API 详情
16
+
17
+ <a id="startbeacondiscovery"></a>
18
+ ### startBeaconDiscovery()
19
+
20
+ 开始搜索附近的 iBeacon。
21
+
22
+ ## 代码示例
23
+
24
+ ```typescript
25
+ import { startBeaconDiscovery } from '@doubao-apps/framework/api';
26
+
27
+ await startBeaconDiscovery({ uuids: ['FDA50693-A4E2-4FB1-AFCF-C6EB07647825'] });
28
+ ```
29
+
30
+ ## 入参
31
+
32
+ |参数名|类型|必填|说明|
33
+ |---|---|---|---|
34
+ |ignoreBluetoothAvailable|`boolean`|否|iOS 下是否忽略蓝牙可用性校验。|
35
+ |uuids|`string[]`|是|要搜索的 iBeacon UUID 列表。|
36
+
37
+ ## 返回值
38
+
39
+ 返回 `Promise<object>`。
40
+
41
+ <a id="stopbeacondiscovery"></a>
42
+ ### stopBeaconDiscovery()
43
+
44
+ 停止搜索附近的 iBeacon。
45
+
46
+ ## 代码示例
47
+
48
+ ```typescript
49
+ import { stopBeaconDiscovery } from '@doubao-apps/framework/api';
50
+
51
+ await stopBeaconDiscovery();
52
+ ```
53
+
54
+ ## 入参
55
+
56
+ 无入参。
57
+
58
+ ## 返回值
59
+
60
+ 返回 `Promise<object>`。
61
+
62
+ <a id="getbeacons"></a>
63
+ ### getBeacons()
64
+
65
+ 获取已搜索到的 iBeacon 列表。
66
+
67
+ ## 代码示例
68
+
69
+ ```typescript
70
+ import { getBeacons } from '@doubao-apps/framework/api';
71
+
72
+ const { beacons } = await getBeacons();
73
+
74
+ console.log(beacons);
75
+ ```
76
+
77
+ ## 入参
78
+
79
+ 无入参。
80
+
81
+ ## 返回值
82
+
83
+ 返回 `Promise<GetBeaconsResult>`。
84
+
85
+ |字段名|类型|说明|
86
+ |---|---|---|
87
+ |beacons|`BeaconInfo[]`|当前搜到的 iBeacon 列表。|
88
+ |beacons[].accuracy|`number`|距离,单位米。|
89
+ |beacons[].major|`string`|主 ID。|
90
+ |beacons[].minor|`string`|次 ID。|
91
+ |beacons[].proximity|`BeaconProximity`|距离等级。|
92
+ |beacons[].rssi|`number`|RSSI 信号强度,单位 dBm。|
93
+ |beacons[].uuid|`string`|Beacon UUID。|
94
+
95
+ **类型说明**
96
+
97
+ - `BeaconProximity`: `0 | 1 | 2 | 3`
@@ -0,0 +1,78 @@
1
+ # Open API: 罗盘
2
+
3
+ 罗盘监听能力。
4
+
5
+ [返回目录](./README.md) | [返回速查](../open-api.md)
6
+
7
+ ## 速查
8
+
9
+ | API | 说明 |
10
+ | --- | --- |
11
+ | [CompassChangeListener](#compasschangelistener) | 罗盘数据变化事件监听函数。<br><br>返回 void,不是 Promise。 |
12
+ | [startCompass](#startcompass) | 开始监听罗盘。 |
13
+ | [stopCompass](#stopcompass) | 停止监听罗盘。 |
14
+
15
+ ## API 详情
16
+
17
+ <a id="compasschangelistener"></a>
18
+ ### CompassChangeListener()
19
+
20
+ 罗盘数据变化事件监听函数。
21
+
22
+ ## 代码示例
23
+
24
+ ```typescript
25
+ // 暂无代码示例
26
+ ```
27
+
28
+ ## 入参
29
+
30
+ |参数名|类型|必填|说明|
31
+ |---|---|---|---|
32
+ |direction|`number`|是|面对的方向度数,范围 0 到 360。|
33
+
34
+ ## 返回值
35
+
36
+ 返回 `void`。
37
+
38
+ <a id="startcompass"></a>
39
+ ### startCompass()
40
+
41
+ 开始监听罗盘。
42
+
43
+ ## 代码示例
44
+
45
+ ```typescript
46
+ import { startCompass } from '@doubao-apps/framework/api';
47
+
48
+ await startCompass();
49
+ ```
50
+
51
+ ## 入参
52
+
53
+ 无入参。
54
+
55
+ ## 返回值
56
+
57
+ 返回 `Promise<object>`。
58
+
59
+ <a id="stopcompass"></a>
60
+ ### stopCompass()
61
+
62
+ 停止监听罗盘。
63
+
64
+ ## 代码示例
65
+
66
+ ```typescript
67
+ import { stopCompass } from '@doubao-apps/framework/api';
68
+
69
+ await stopCompass();
70
+ ```
71
+
72
+ ## 入参
73
+
74
+ 无入参。
75
+
76
+ ## 返回值
77
+
78
+ 返回 `Promise<object>`。
@@ -0,0 +1,86 @@
1
+ # Open API: 设备方向
2
+
3
+ 设备方向监听能力。
4
+
5
+ [返回目录](./README.md) | [返回速查](../open-api.md)
6
+
7
+ ## 速查
8
+
9
+ | API | 说明 |
10
+ | --- | --- |
11
+ | [DeviceMotionChangeListener](#devicemotionchangelistener) | 设备方向变化事件监听函数。<br><br>返回 void,不是 Promise。 |
12
+ | [startDeviceMotionListening](#startdevicemotionlistening) | 开始监听设备方向变化。 |
13
+ | [stopDeviceMotionListening](#stopdevicemotionlistening) | 停止监听设备方向变化。 |
14
+
15
+ ## API 详情
16
+
17
+ <a id="devicemotionchangelistener"></a>
18
+ ### DeviceMotionChangeListener()
19
+
20
+ 设备方向变化事件监听函数。
21
+
22
+ ## 代码示例
23
+
24
+ ```typescript
25
+ // 暂无代码示例
26
+ ```
27
+
28
+ ## 入参
29
+
30
+ |参数名|类型|必填|说明|
31
+ |---|---|---|---|
32
+ |alpha|`number`|是|当手机坐标 X/Y 和地球坐标 X/Y 重合时,绕 Z 轴转动的夹角。<br>范围为 [0, 2π),逆时针转动为正。|
33
+ |beta|`number`|是|当手机坐标 Y/Z 和地球坐标 Y/Z 重合时,绕 X 轴转动的夹角。<br>范围为 [-π, π)。|
34
+ |gamma|`number`|是|当手机坐标 X/Z 和地球坐标 X/Z 重合时,绕 Y 轴转动的夹角。<br>范围为 [-π/2, π/2)。|
35
+
36
+ ## 返回值
37
+
38
+ 返回 `void`。
39
+
40
+ <a id="startdevicemotionlistening"></a>
41
+ ### startDeviceMotionListening()
42
+
43
+ 开始监听设备方向变化。
44
+
45
+ ## 代码示例
46
+
47
+ ```typescript
48
+ import { startDeviceMotionListening } from '@doubao-apps/framework/api';
49
+
50
+ await startDeviceMotionListening({ interval: 'normal' });
51
+ ```
52
+
53
+ ## 入参
54
+
55
+ |参数名|类型|必填|说明|
56
+ |---|---|---|---|
57
+ |interval|`SensorInterval`|否|监听频率。|
58
+
59
+ **类型说明**
60
+
61
+ - `SensorInterval`: `"game" | "ui" | "normal"`
62
+
63
+ ## 返回值
64
+
65
+ 返回 `Promise<object>`。
66
+
67
+ <a id="stopdevicemotionlistening"></a>
68
+ ### stopDeviceMotionListening()
69
+
70
+ 停止监听设备方向变化。
71
+
72
+ ## 代码示例
73
+
74
+ ```typescript
75
+ import { stopDeviceMotionListening } from '@doubao-apps/framework/api';
76
+
77
+ await stopDeviceMotionListening();
78
+ ```
79
+
80
+ ## 入参
81
+
82
+ 无入参。
83
+
84
+ ## 返回值
85
+
86
+ 返回 `Promise<object>`。
@@ -0,0 +1,87 @@
1
+ # Open API: 陀螺仪
2
+
3
+ 陀螺仪监听能力。
4
+
5
+ [返回目录](./README.md) | [返回速查](../open-api.md)
6
+
7
+ ## 速查
8
+
9
+ | API | 说明 |
10
+ | --- | --- |
11
+ | [GyroscopeChangeListener](#gyroscopechangelistener) | 陀螺仪数据变化事件监听函数。<br><br>返回 void,不是 Promise。 |
12
+ | [startGyroscope](#startgyroscope) | 开始监听陀螺仪。 |
13
+ | [stopGyroscope](#stopgyroscope) | 停止监听陀螺仪。 |
14
+
15
+ ## API 详情
16
+
17
+ <a id="gyroscopechangelistener"></a>
18
+ ### GyroscopeChangeListener()
19
+
20
+ 陀螺仪数据变化事件监听函数。
21
+
22
+ ## 代码示例
23
+
24
+ ```typescript
25
+ // 暂无代码示例
26
+ ```
27
+
28
+ ## 入参
29
+
30
+ |参数名|类型|必填|说明|
31
+ |---|---|---|---|
32
+ |timestamp|`number`|是|数据采集时间戳,单位纳秒。|
33
+ |x|`number`|是|绕 X 轴旋转的角速度,单位 rad/s。|
34
+ |y|`number`|是|绕 Y 轴旋转的角速度,单位 rad/s。|
35
+ |z|`number`|是|绕 Z 轴旋转的角速度,单位 rad/s。|
36
+
37
+ ## 返回值
38
+
39
+ 返回 `void`。
40
+
41
+ <a id="startgyroscope"></a>
42
+ ### startGyroscope()
43
+
44
+ 开始监听陀螺仪。
45
+
46
+ ## 代码示例
47
+
48
+ ```typescript
49
+ import { startGyroscope } from '@doubao-apps/framework/api';
50
+
51
+ await startGyroscope({ interval: 'normal' });
52
+ ```
53
+
54
+ ## 入参
55
+
56
+ |参数名|类型|必填|说明|
57
+ |---|---|---|---|
58
+ |interval|`SensorInterval`|否|监听频率。|
59
+
60
+ **类型说明**
61
+
62
+ - `SensorInterval`: `"game" | "ui" | "normal"`
63
+
64
+ ## 返回值
65
+
66
+ 返回 `Promise<object>`。
67
+
68
+ <a id="stopgyroscope"></a>
69
+ ### stopGyroscope()
70
+
71
+ 停止监听陀螺仪。
72
+
73
+ ## 代码示例
74
+
75
+ ```typescript
76
+ import { stopGyroscope } from '@doubao-apps/framework/api';
77
+
78
+ await stopGyroscope();
79
+ ```
80
+
81
+ ## 入参
82
+
83
+ 无入参。
84
+
85
+ ## 返回值
86
+
87
+ 返回 `Promise<object>`。