@doubao-apps/create 0.0.27 → 0.0.28
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/36.js +1 -1
- package/dist/cli.js +10 -10
- package/dist/template-empty/AGENTS.md +20 -20
- package/dist/template-empty/package.json +2 -2
- package/dist/template-empty/references/reference/open-api/01-/345/237/272/347/241/200-/350/264/246/345/217/267-/347/263/273/347/273/237.md +2943 -0
- package/dist/template-empty/references/reference/open-api/02-/350/267/257/347/224/261.md +63 -0
- package/dist/template-empty/{.ai/reference/open-api/05- → references/reference/open-api/03-}/347/225/214/351/235/242-/350/276/223/345/205/245.md +30 -0
- package/dist/template-empty/references/reference/open-api/04-/346/225/260/346/215/256/345/210/206/346/236/220.md +67 -0
- package/dist/{template-starter/.ai/reference/open-api/16-ui- → template-empty/references/reference/open-api/12-ui-}/350/276/223/345/205/245.md +0 -16
- package/dist/template-empty/references/reference/open-api/README.md +32 -0
- package/dist/template-empty/{.ai → references}/reference/open-api.md +420 -10
- package/dist/template-starter/AGENTS.md +20 -20
- package/dist/template-starter/README.md +48 -33
- package/dist/template-starter/package.json +2 -2
- package/dist/template-starter/references/reference/open-api/01-/345/237/272/347/241/200-/350/264/246/345/217/267-/347/263/273/347/273/237.md +2943 -0
- package/dist/template-starter/references/reference/open-api/02-/350/267/257/347/224/261.md +63 -0
- package/dist/template-starter/{.ai/reference/open-api/05- → references/reference/open-api/03-}/347/225/214/351/235/242-/350/276/223/345/205/245.md +30 -0
- package/dist/template-starter/references/reference/open-api/04-/346/225/260/346/215/256/345/210/206/346/236/220.md +67 -0
- package/dist/{template-empty/.ai/reference/open-api/16-ui- → template-starter/references/reference/open-api/12-ui-}/350/276/223/345/205/245.md +0 -16
- package/dist/template-starter/references/reference/open-api/README.md +32 -0
- package/dist/template-starter/{.ai → references}/reference/open-api.md +420 -10
- package/package.json +1 -1
- package/dist/template-empty/.ai/guides/system-prompt.md +0 -331
- package/dist/template-empty/.ai/reference/open-api/01-/345/237/272/347/241/200-/350/264/246/345/217/267-/347/263/273/347/273/237.md +0 -699
- package/dist/template-empty/.ai/reference/open-api/02-/345/255/230/345/202/250.md +0 -409
- package/dist/template-empty/.ai/reference/open-api/03-/350/267/257/347/224/261.md +0 -165
- package/dist/template-empty/.ai/reference/open-api/04-/347/225/214/351/235/242-/344/272/244/344/272/222.md +0 -432
- package/dist/template-empty/.ai/reference/open-api/06-/347/275/221/347/273/234.md +0 -148
- package/dist/template-empty/.ai/reference/open-api/07-/345/252/222/344/275/223.md +0 -346
- package/dist/template-empty/.ai/reference/open-api/08-/345/274/200/346/224/276/350/203/275/345/212/233-/344/270/232/345/212/241/350/203/275/345/212/233.md +0 -546
- package/dist/template-empty/.ai/reference/open-api/README.md +0 -36
- package/dist/template-starter/.ai/guides/system-prompt.md +0 -331
- package/dist/template-starter/.ai/reference/open-api/01-/345/237/272/347/241/200-/350/264/246/345/217/267-/347/263/273/347/273/237.md +0 -699
- package/dist/template-starter/.ai/reference/open-api/02-/345/255/230/345/202/250.md +0 -409
- package/dist/template-starter/.ai/reference/open-api/03-/350/267/257/347/224/261.md +0 -165
- package/dist/template-starter/.ai/reference/open-api/04-/347/225/214/351/235/242-/344/272/244/344/272/222.md +0 -432
- package/dist/template-starter/.ai/reference/open-api/06-/347/275/221/347/273/234.md +0 -148
- package/dist/template-starter/.ai/reference/open-api/07-/345/252/222/344/275/223.md +0 -346
- package/dist/template-starter/.ai/reference/open-api/08-/345/274/200/346/224/276/350/203/275/345/212/233-/344/270/232/345/212/241/350/203/275/345/212/233.md +0 -546
- package/dist/template-starter/.ai/reference/open-api/README.md +0 -36
- /package/dist/template-empty/{.ai → references}/examples/common-patterns.md +0 -0
- /package/dist/template-empty/{.ai → references}/examples/component-basics.md +0 -0
- /package/dist/template-empty/{.ai → references}/guides/best-practices.md +0 -0
- /package/dist/template-empty/{.ai → references}/guides/component-development.md +0 -0
- /package/dist/template-empty/{.ai → references}/guides/performance-optimization.md +0 -0
- /package/dist/template-empty/{.ai → references}/guides/troubleshooting.md +0 -0
- /package/dist/template-empty/{.ai → references}/reference/components-quick-ref.md +0 -0
- /package/dist/template-empty/{.ai → references}/reference/framework-api-quick-ref.md +0 -0
- /package/dist/template-empty/{.ai/reference/open-api/09- → references/reference/open-api/05-}/350/256/276/345/244/207-/350/223/235/347/211/231.md" +0 -0
- /package/dist/template-empty/{.ai/reference/open-api/10- → references/reference/open-api/06-}/350/256/276/345/244/207-wi-fi.md" +0 -0
- /package/dist/template-empty/{.ai/reference/open-api/11- → references/reference/open-api/07-}/350/256/276/345/244/207-/345/212/240/351/200/237/345/272/246/350/256/241.md" +0 -0
- /package/dist/template-empty/{.ai/reference/open-api/12- → references/reference/open-api/08-}/350/256/276/345/244/207-ibeacon.md" +0 -0
- /package/dist/template-empty/{.ai/reference/open-api/13- → references/reference/open-api/09-}/350/256/276/345/244/207-/347/275/227/347/233/230.md" +0 -0
- /package/dist/template-empty/{.ai/reference/open-api/14- → references/reference/open-api/10-}/350/256/276/345/244/207-/350/256/276/345/244/207/346/226/271/345/220/221.md" +0 -0
- /package/dist/template-empty/{.ai/reference/open-api/15- → references/reference/open-api/11-}/350/256/276/345/244/207-/351/231/200/350/236/272/344/273/252.md" +0 -0
- /package/dist/template-empty/{.ai/reference/open-api/17- → references/reference/open-api/13-}/350/256/276/345/244/207-/347/275/221/347/273/234.md" +0 -0
- /package/dist/template-empty/{.ai/reference/open-api/18- → references/reference/open-api/14-}/350/256/276/345/244/207-/347/237/255/344/277/241.md" +0 -0
- /package/dist/template-empty/{.ai/reference/open-api/19- → references/reference/open-api/15-}/350/256/276/345/244/207-/346/227/240/351/232/234/347/242/215.md" +0 -0
- /package/dist/template-empty/{.ai/reference/open-api/20- → references/reference/open-api/16-}/350/256/276/345/244/207-/347/224/265/346/261/240.md" +0 -0
- /package/dist/template-empty/{.ai/reference/open-api/21- → references/reference/open-api/17-}/350/256/276/345/244/207-/346/227/245/345/216/206.md" +0 -0
- /package/dist/template-empty/{.ai/reference/open-api/22- → references/reference/open-api/18-}/350/256/276/345/244/207-/345/211/252/350/264/264/346/235/277.md" +0 -0
- /package/dist/template-empty/{.ai/reference/open-api/23- → references/reference/open-api/19-}/350/256/276/345/244/207-/350/201/224/347/263/273/344/272/272.md" +0 -0
- /package/dist/template-empty/{.ai/reference/open-api/24- → references/reference/open-api/20-}/350/256/276/345/244/207-/345/212/240/345/257/206.md" +0 -0
- /package/dist/template-empty/{.ai/reference/open-api/25- → references/reference/open-api/21-}/350/256/276/345/244/207-/347/224/265/350/257/235.md" +0 -0
- /package/dist/template-empty/{.ai/reference/open-api/26- → references/reference/open-api/22-}/350/256/276/345/244/207-/346/211/253/347/240/201.md" +0 -0
- /package/dist/template-empty/{.ai/reference/open-api/27- → references/reference/open-api/23-}/350/256/276/345/244/207-/345/261/217/345/271/225.md" +0 -0
- /package/dist/template-empty/{.ai/reference/open-api/28- → references/reference/open-api/24-}/350/256/276/345/244/207-/351/234/207/345/212/250.md" +0 -0
- /package/dist/template-empty/{.ai → references}/rules/dos-and-donts.md +0 -0
- /package/dist/template-starter/{.ai → references}/examples/common-patterns.md +0 -0
- /package/dist/template-starter/{.ai → references}/examples/component-basics.md +0 -0
- /package/dist/template-starter/{.ai → references}/guides/best-practices.md +0 -0
- /package/dist/template-starter/{.ai → references}/guides/component-development.md +0 -0
- /package/dist/template-starter/{.ai → references}/guides/performance-optimization.md +0 -0
- /package/dist/template-starter/{.ai → references}/guides/troubleshooting.md +0 -0
- /package/dist/template-starter/{.ai → references}/reference/components-quick-ref.md +0 -0
- /package/dist/template-starter/{.ai → references}/reference/framework-api-quick-ref.md +0 -0
- /package/dist/template-starter/{.ai/reference/open-api/09- → references/reference/open-api/05-}/350/256/276/345/244/207-/350/223/235/347/211/231.md" +0 -0
- /package/dist/template-starter/{.ai/reference/open-api/10- → references/reference/open-api/06-}/350/256/276/345/244/207-wi-fi.md" +0 -0
- /package/dist/template-starter/{.ai/reference/open-api/11- → references/reference/open-api/07-}/350/256/276/345/244/207-/345/212/240/351/200/237/345/272/246/350/256/241.md" +0 -0
- /package/dist/template-starter/{.ai/reference/open-api/12- → references/reference/open-api/08-}/350/256/276/345/244/207-ibeacon.md" +0 -0
- /package/dist/template-starter/{.ai/reference/open-api/13- → references/reference/open-api/09-}/350/256/276/345/244/207-/347/275/227/347/233/230.md" +0 -0
- /package/dist/template-starter/{.ai/reference/open-api/14- → references/reference/open-api/10-}/350/256/276/345/244/207-/350/256/276/345/244/207/346/226/271/345/220/221.md" +0 -0
- /package/dist/template-starter/{.ai/reference/open-api/15- → references/reference/open-api/11-}/350/256/276/345/244/207-/351/231/200/350/236/272/344/273/252.md" +0 -0
- /package/dist/template-starter/{.ai/reference/open-api/17- → references/reference/open-api/13-}/350/256/276/345/244/207-/347/275/221/347/273/234.md" +0 -0
- /package/dist/template-starter/{.ai/reference/open-api/18- → references/reference/open-api/14-}/350/256/276/345/244/207-/347/237/255/344/277/241.md" +0 -0
- /package/dist/template-starter/{.ai/reference/open-api/19- → references/reference/open-api/15-}/350/256/276/345/244/207-/346/227/240/351/232/234/347/242/215.md" +0 -0
- /package/dist/template-starter/{.ai/reference/open-api/20- → references/reference/open-api/16-}/350/256/276/345/244/207-/347/224/265/346/261/240.md" +0 -0
- /package/dist/template-starter/{.ai/reference/open-api/21- → references/reference/open-api/17-}/350/256/276/345/244/207-/346/227/245/345/216/206.md" +0 -0
- /package/dist/template-starter/{.ai/reference/open-api/22- → references/reference/open-api/18-}/350/256/276/345/244/207-/345/211/252/350/264/264/346/235/277.md" +0 -0
- /package/dist/template-starter/{.ai/reference/open-api/23- → references/reference/open-api/19-}/350/256/276/345/244/207-/350/201/224/347/263/273/344/272/272.md" +0 -0
- /package/dist/template-starter/{.ai/reference/open-api/24- → references/reference/open-api/20-}/350/256/276/345/244/207-/345/212/240/345/257/206.md" +0 -0
- /package/dist/template-starter/{.ai/reference/open-api/25- → references/reference/open-api/21-}/350/256/276/345/244/207-/347/224/265/350/257/235.md" +0 -0
- /package/dist/template-starter/{.ai/reference/open-api/26- → references/reference/open-api/22-}/350/256/276/345/244/207-/346/211/253/347/240/201.md" +0 -0
- /package/dist/template-starter/{.ai/reference/open-api/27- → references/reference/open-api/23-}/350/256/276/345/244/207-/345/261/217/345/271/225.md" +0 -0
- /package/dist/template-starter/{.ai/reference/open-api/28- → references/reference/open-api/24-}/350/256/276/345/244/207-/351/234/207/345/212/250.md" +0 -0
- /package/dist/template-starter/{.ai → references}/rules/dos-and-donts.md +0 -0
|
@@ -1,699 +0,0 @@
|
|
|
1
|
-
# Open API: 基础 / 账号 / 系统
|
|
2
|
-
|
|
3
|
-
账号、授权、宿主基础信息、窗口信息和定位。
|
|
4
|
-
|
|
5
|
-
[返回目录](./README.md) | [返回速查](../open-api.md)
|
|
6
|
-
|
|
7
|
-
## 速查
|
|
8
|
-
|
|
9
|
-
| API | 说明 |
|
|
10
|
-
| --- | --- |
|
|
11
|
-
| [getAccountInfo](#getaccountinfo) | 异步获取账号信息。 |
|
|
12
|
-
| [getAccountInfoSync](#getaccountinfosync) | 同步获取账号信息。<br><br>同步 API。 |
|
|
13
|
-
| [authorize](#authorize) | 初始化授权。<br><br>按 scope 申请授权。 |
|
|
14
|
-
| [canIUse](#caniuse) | 检测当前宿主是否支持指定 API 或能力。<br><br>用于兼容性判断。 |
|
|
15
|
-
| [getLocation](#getlocation) | 获取设备当前的地理位置信息。<br><br>可能涉及定位授权。 |
|
|
16
|
-
| [login](#login) | 发起登录并获取登录凭证。 |
|
|
17
|
-
| [getWindowInfoSync](#getwindowinfosync) | 获取窗口信息。<br><br>同步 API。 |
|
|
18
|
-
| [getSystemSetting](#getsystemsetting) | 获取设备设置。 |
|
|
19
|
-
| [getAppBaseInfoSync](#getappbaseinfosync) | 获取应用基础信息。<br><br>同步 API。 |
|
|
20
|
-
| [getWindowInfo](#getwindowinfo) | 获取窗口信息。 |
|
|
21
|
-
| [getAppBaseInfo](#getappbaseinfo) | 获取应用基础信息。 |
|
|
22
|
-
|
|
23
|
-
## API 详情
|
|
24
|
-
|
|
25
|
-
<a id="getaccountinfo"></a>
|
|
26
|
-
### getAccountInfo()
|
|
27
|
-
|
|
28
|
-
> **getAccountInfo**(`params`?): `Promise`\<[`GetAccountInfoResult`](#getaccountinforesult)\>
|
|
29
|
-
|
|
30
|
-
异步获取账号信息。
|
|
31
|
-
|
|
32
|
-
#### Parameters
|
|
33
|
-
|
|
34
|
-
• **params?**
|
|
35
|
-
|
|
36
|
-
#### Returns
|
|
37
|
-
|
|
38
|
-
`Promise`\<[`GetAccountInfoResult`](#getaccountinforesult)\>
|
|
39
|
-
|
|
40
|
-
#### Example
|
|
41
|
-
|
|
42
|
-
```typescript
|
|
43
|
-
import { getAccountInfo } from '@doubao-apps/framework/api';
|
|
44
|
-
|
|
45
|
-
const result = await getAccountInfo();
|
|
46
|
-
console.log(result.miniProgram.appId);
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
<a id="getaccountinfosync"></a>
|
|
50
|
-
### getAccountInfoSync()
|
|
51
|
-
|
|
52
|
-
> **getAccountInfoSync**(`params`?): [`GetAccountInfoResult`](#getaccountinforesult)
|
|
53
|
-
|
|
54
|
-
同步获取账号信息。
|
|
55
|
-
|
|
56
|
-
#### Parameters
|
|
57
|
-
|
|
58
|
-
• **params?**
|
|
59
|
-
|
|
60
|
-
#### Returns
|
|
61
|
-
|
|
62
|
-
[`GetAccountInfoResult`](#getaccountinforesult)
|
|
63
|
-
|
|
64
|
-
#### Example
|
|
65
|
-
|
|
66
|
-
```typescript
|
|
67
|
-
import { getAccountInfoSync } from '@doubao-apps/framework/api';
|
|
68
|
-
|
|
69
|
-
const result = getAccountInfoSync();
|
|
70
|
-
console.log(result.miniProgram.appId, result.miniProgram.envVersion, result.miniProgram.version);
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
<a id="authorize"></a>
|
|
74
|
-
### authorize()
|
|
75
|
-
|
|
76
|
-
> **authorize**(`params`): `Promise`\<`object`\>
|
|
77
|
-
|
|
78
|
-
初始化授权
|
|
79
|
-
|
|
80
|
-
#### Parameters
|
|
81
|
-
|
|
82
|
-
• **params**: [`AuthorizeRequest`](#authorizerequest)
|
|
83
|
-
|
|
84
|
-
授权参数
|
|
85
|
-
|
|
86
|
-
#### Returns
|
|
87
|
-
|
|
88
|
-
`Promise`\<`object`\>
|
|
89
|
-
|
|
90
|
-
Promise 对象,授权成功时会返回授权结果
|
|
91
|
-
|
|
92
|
-
#### Remarks
|
|
93
|
-
|
|
94
|
-
按 scope 申请授权。
|
|
95
|
-
|
|
96
|
-
<a id="caniuse"></a>
|
|
97
|
-
### canIUse()
|
|
98
|
-
|
|
99
|
-
> **canIUse**(`params`): `Promise`\<[`CanIUseResult`](#caniuseresult)\>
|
|
100
|
-
|
|
101
|
-
检测当前宿主是否支持指定 API 或能力。
|
|
102
|
-
|
|
103
|
-
#### Parameters
|
|
104
|
-
|
|
105
|
-
• **params**: [`CanIUseParams`](#caniuseparams)
|
|
106
|
-
|
|
107
|
-
#### Returns
|
|
108
|
-
|
|
109
|
-
`Promise`\<[`CanIUseResult`](#caniuseresult)\>
|
|
110
|
-
|
|
111
|
-
#### Remarks
|
|
112
|
-
|
|
113
|
-
用于兼容性判断。
|
|
114
|
-
|
|
115
|
-
<a id="getlocation"></a>
|
|
116
|
-
### getLocation()
|
|
117
|
-
|
|
118
|
-
> **getLocation**(`params`?): `Promise`\<[`GetLocationResponse`](#getlocationresponse)\>
|
|
119
|
-
|
|
120
|
-
获取设备当前的地理位置信息。
|
|
121
|
-
|
|
122
|
-
#### Parameters
|
|
123
|
-
|
|
124
|
-
• **params?**: [`GetLocationParams`](#getlocationparams)
|
|
125
|
-
|
|
126
|
-
#### Returns
|
|
127
|
-
|
|
128
|
-
`Promise`\<[`GetLocationResponse`](#getlocationresponse)\>
|
|
129
|
-
|
|
130
|
-
返回一个 Promise,成功时解析为包含地理位置信息的对象,包含:
|
|
131
|
-
- `latitude`: number - 纬度。
|
|
132
|
-
- `longitude`: number - 经度。
|
|
133
|
-
- `timestamp`: string - 时间戳。
|
|
134
|
-
- `speed`: number - 行进速度,单位:米/秒。
|
|
135
|
-
- `accuracy`: number - 定位精度,单位:米。
|
|
136
|
-
参考 [GetLocationResponse](#getlocationresponse)。
|
|
137
|
-
|
|
138
|
-
#### Throws
|
|
139
|
-
|
|
140
|
-
如果调用失败(例如,用户拒绝权限、定位服务关闭等),则抛出此错误。
|
|
141
|
-
|
|
142
|
-
#### Remarks
|
|
143
|
-
|
|
144
|
-
可能涉及定位授权。
|
|
145
|
-
|
|
146
|
-
#### Example
|
|
147
|
-
|
|
148
|
-
```typescript
|
|
149
|
-
import { getLocation } from '@doubao-apps/framework';
|
|
150
|
-
|
|
151
|
-
async function fetchLocation() {
|
|
152
|
-
try {
|
|
153
|
-
const locationData = await getLocation();
|
|
154
|
-
console.log('纬度:', locationData.latitude);
|
|
155
|
-
console.log('经度:', locationData.longitude);
|
|
156
|
-
console.log('时间戳:', locationData.timestamp);
|
|
157
|
-
console.log('行进速度:', locationData.speed);
|
|
158
|
-
console.log('定位精度:', locationData.accuracy);
|
|
159
|
-
} catch (error) {
|
|
160
|
-
console.error('获取位置失败:', error);
|
|
161
|
-
// 处理错误,例如提示用户开启定位权限
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
fetchLocation();
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
<a id="login"></a>
|
|
169
|
-
### login()
|
|
170
|
-
|
|
171
|
-
> **login**(`params`?): `Promise`\<[`LoginResult`](#loginresult)\>
|
|
172
|
-
|
|
173
|
-
发起登录并获取登录凭证。
|
|
174
|
-
|
|
175
|
-
#### Parameters
|
|
176
|
-
|
|
177
|
-
• **params?**: [`LoginRequest`](#loginrequest)
|
|
178
|
-
|
|
179
|
-
登录参数。
|
|
180
|
-
|
|
181
|
-
#### Returns
|
|
182
|
-
|
|
183
|
-
`Promise`\<[`LoginResult`](#loginresult)\>
|
|
184
|
-
|
|
185
|
-
返回包含登录凭证 code 的 Promise。
|
|
186
|
-
|
|
187
|
-
<a id="getwindowinfosync"></a>
|
|
188
|
-
### getWindowInfoSync()
|
|
189
|
-
|
|
190
|
-
> **getWindowInfoSync**(`_param`?): [`GetWindowInfoResult`](#getwindowinforesult)
|
|
191
|
-
|
|
192
|
-
获取窗口信息。
|
|
193
|
-
|
|
194
|
-
#### Parameters
|
|
195
|
-
|
|
196
|
-
• **\_param?**
|
|
197
|
-
|
|
198
|
-
#### Returns
|
|
199
|
-
|
|
200
|
-
[`GetWindowInfoResult`](#getwindowinforesult)
|
|
201
|
-
|
|
202
|
-
返回窗口尺寸、状态栏高度和安全区域等信息,字段见 [GetWindowInfoResult](#getwindowinforesult)。
|
|
203
|
-
|
|
204
|
-
#### Example
|
|
205
|
-
|
|
206
|
-
```typescript
|
|
207
|
-
import { getWindowInfoSync } from '@doubao-apps/framework/api';
|
|
208
|
-
|
|
209
|
-
const result = getWindowInfoSync();
|
|
210
|
-
|
|
211
|
-
console.log(result.windowWidth, result.windowHeight);
|
|
212
|
-
console.log(result.safeArea?.top, result.screenTop);
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
<a id="getsystemsetting"></a>
|
|
216
|
-
### getSystemSetting()
|
|
217
|
-
|
|
218
|
-
> **getSystemSetting**(`params`?): [`GetSystemSettingResult`](#getsystemsettingresult)
|
|
219
|
-
|
|
220
|
-
获取设备设置。
|
|
221
|
-
|
|
222
|
-
#### Parameters
|
|
223
|
-
|
|
224
|
-
• **params?**
|
|
225
|
-
|
|
226
|
-
#### Returns
|
|
227
|
-
|
|
228
|
-
[`GetSystemSettingResult`](#getsystemsettingresult)
|
|
229
|
-
|
|
230
|
-
返回蓝牙、定位、Wi-Fi 系统开关和设备方向等字段,见 [GetSystemSettingResult](#getsystemsettingresult)。
|
|
231
|
-
|
|
232
|
-
#### Example
|
|
233
|
-
|
|
234
|
-
```typescript
|
|
235
|
-
import { getSystemSetting } from '@doubao-apps/framework/api';
|
|
236
|
-
|
|
237
|
-
const result = getSystemSetting();
|
|
238
|
-
|
|
239
|
-
console.log(result.bluetoothEnabled, result.locationEnabled);
|
|
240
|
-
console.log(result.wifiEnabled, result.deviceOrientation);
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
<a id="getappbaseinfosync"></a>
|
|
244
|
-
### getAppBaseInfoSync()
|
|
245
|
-
|
|
246
|
-
> **getAppBaseInfoSync**(`_params`?): [`GetAppBaseInfoResult`](#getappbaseinforesult)
|
|
247
|
-
|
|
248
|
-
获取应用基础信息。
|
|
249
|
-
|
|
250
|
-
#### Parameters
|
|
251
|
-
|
|
252
|
-
• **\_params?**
|
|
253
|
-
|
|
254
|
-
#### Returns
|
|
255
|
-
|
|
256
|
-
[`GetAppBaseInfoResult`](#getappbaseinforesult)
|
|
257
|
-
|
|
258
|
-
返回 SDK 版本、调试开关、宿主信息、语言和主题等字段,见 [GetAppBaseInfoResult](#getappbaseinforesult)。
|
|
259
|
-
|
|
260
|
-
#### Example
|
|
261
|
-
|
|
262
|
-
```typescript
|
|
263
|
-
import { getAppBaseInfoSync } from '@doubao-apps/framework/api';
|
|
264
|
-
|
|
265
|
-
const result = getAppBaseInfoSync();
|
|
266
|
-
|
|
267
|
-
console.log(result.language, result.SDKVersion, result.theme);
|
|
268
|
-
console.log(result.host?.appId, result.enableDebug);
|
|
269
|
-
```
|
|
270
|
-
|
|
271
|
-
<a id="getwindowinfo"></a>
|
|
272
|
-
### getWindowInfo()
|
|
273
|
-
|
|
274
|
-
> **getWindowInfo**(`_params`?): `Promise`\<[`GetWindowInfoResult`](#getwindowinforesult)\>
|
|
275
|
-
|
|
276
|
-
获取窗口信息。
|
|
277
|
-
|
|
278
|
-
#### Parameters
|
|
279
|
-
|
|
280
|
-
• **\_params?**
|
|
281
|
-
|
|
282
|
-
#### Returns
|
|
283
|
-
|
|
284
|
-
`Promise`\<[`GetWindowInfoResult`](#getwindowinforesult)\>
|
|
285
|
-
|
|
286
|
-
返回窗口尺寸、状态栏高度和安全区域等信息,字段见 [GetWindowInfoResult](#getwindowinforesult)。
|
|
287
|
-
|
|
288
|
-
#### Example
|
|
289
|
-
|
|
290
|
-
```typescript
|
|
291
|
-
import { getWindowInfo } from '@doubao-apps/framework/api';
|
|
292
|
-
|
|
293
|
-
const result = await getWindowInfo();
|
|
294
|
-
|
|
295
|
-
console.log(result.windowWidth, result.windowHeight);
|
|
296
|
-
console.log(result.safeArea?.top, result.screenTop);
|
|
297
|
-
```
|
|
298
|
-
|
|
299
|
-
<a id="getappbaseinfo"></a>
|
|
300
|
-
### getAppBaseInfo()
|
|
301
|
-
|
|
302
|
-
> **getAppBaseInfo**(`params`?): `Promise`\<[`GetAppBaseInfoResult`](#getappbaseinforesult)\>
|
|
303
|
-
|
|
304
|
-
获取应用基础信息。
|
|
305
|
-
|
|
306
|
-
#### Parameters
|
|
307
|
-
|
|
308
|
-
• **params?**
|
|
309
|
-
|
|
310
|
-
#### Returns
|
|
311
|
-
|
|
312
|
-
`Promise`\<[`GetAppBaseInfoResult`](#getappbaseinforesult)\>
|
|
313
|
-
|
|
314
|
-
返回 SDK 版本、调试开关、宿主信息、语言和主题等字段,见 [GetAppBaseInfoResult](#getappbaseinforesult)。
|
|
315
|
-
|
|
316
|
-
#### Example
|
|
317
|
-
|
|
318
|
-
```typescript
|
|
319
|
-
import { getAppBaseInfo } from '@doubao-apps/framework/api';
|
|
320
|
-
|
|
321
|
-
const result = await getAppBaseInfo();
|
|
322
|
-
|
|
323
|
-
console.log(result.language, result.SDKVersion, result.theme);
|
|
324
|
-
console.log(result.host?.appId, result.enableDebug);
|
|
325
|
-
```
|
|
326
|
-
|
|
327
|
-
## 相关类型
|
|
328
|
-
|
|
329
|
-
<a id="getaccountinforesult"></a>
|
|
330
|
-
### GetAccountInfoResult
|
|
331
|
-
|
|
332
|
-
获取当前账号信息。
|
|
333
|
-
|
|
334
|
-
#### Properties
|
|
335
|
-
|
|
336
|
-
##### miniProgram
|
|
337
|
-
|
|
338
|
-
> **miniProgram**: [`DoubaoAppAccountInfo`](#doubaoappaccountinfo)
|
|
339
|
-
|
|
340
|
-
豆包 App账号信息
|
|
341
|
-
|
|
342
|
-
##### plugin?
|
|
343
|
-
|
|
344
|
-
> `optional` **plugin**: [`PluginAccountInfo`](#pluginaccountinfo)
|
|
345
|
-
|
|
346
|
-
插件账号信息(仅在插件中调用时包含)
|
|
347
|
-
|
|
348
|
-
<a id="doubaoappaccountinfo"></a>
|
|
349
|
-
### DoubaoAppAccountInfo
|
|
350
|
-
|
|
351
|
-
豆包 App 账号信息。
|
|
352
|
-
|
|
353
|
-
#### Properties
|
|
354
|
-
|
|
355
|
-
##### appId
|
|
356
|
-
|
|
357
|
-
> **appId**: `string`
|
|
358
|
-
|
|
359
|
-
豆包 App appId
|
|
360
|
-
|
|
361
|
-
##### envVersion
|
|
362
|
-
|
|
363
|
-
> **envVersion**: `"develop"` \| `"trial"` \| `"release"`
|
|
364
|
-
|
|
365
|
-
豆包 App 运行环境。
|
|
366
|
-
|
|
367
|
-
- develop: 开发版
|
|
368
|
-
- trial: 体验版
|
|
369
|
-
- release: 正式版
|
|
370
|
-
|
|
371
|
-
##### version
|
|
372
|
-
|
|
373
|
-
> **version**: `string`
|
|
374
|
-
|
|
375
|
-
线上豆包 App 版本号。
|
|
376
|
-
|
|
377
|
-
<a id="pluginaccountinfo"></a>
|
|
378
|
-
### PluginAccountInfo
|
|
379
|
-
|
|
380
|
-
插件账号信息(仅在插件中调用时包含)。
|
|
381
|
-
|
|
382
|
-
#### Properties
|
|
383
|
-
|
|
384
|
-
##### appId
|
|
385
|
-
|
|
386
|
-
> **appId**: `string`
|
|
387
|
-
|
|
388
|
-
插件 appId
|
|
389
|
-
|
|
390
|
-
##### version
|
|
391
|
-
|
|
392
|
-
> **version**: `string`
|
|
393
|
-
|
|
394
|
-
插件版本号,'a.b.c' 形式
|
|
395
|
-
|
|
396
|
-
<a id="authorizerequest"></a>
|
|
397
|
-
### AuthorizeRequest
|
|
398
|
-
|
|
399
|
-
#### Properties
|
|
400
|
-
|
|
401
|
-
##### scope
|
|
402
|
-
|
|
403
|
-
> **scope**: [`Scope`](#scope-1)
|
|
404
|
-
|
|
405
|
-
授权范围
|
|
406
|
-
|
|
407
|
-
<a id="scope-1"></a>
|
|
408
|
-
<a id="scope"></a>
|
|
409
|
-
### Scope
|
|
410
|
-
|
|
411
|
-
> **Scope**: `"scope.userLocation"` \| `"scope.userFuzzyLocation"` \| `"scope.userLocationBackground"` \| `"scope.payment"` \| `"scope.record"` \| `"scope.bluetooth"` \| `"scope.camera"` \| `"scope.addPhoneContact"` \| `"scope.addPhoneCalendar"`
|
|
412
|
-
|
|
413
|
-
<a id="caniuseparams"></a>
|
|
414
|
-
### CanIUseParams
|
|
415
|
-
|
|
416
|
-
#### Properties
|
|
417
|
-
|
|
418
|
-
##### schema
|
|
419
|
-
|
|
420
|
-
> **schema**: `string`
|
|
421
|
-
|
|
422
|
-
<a id="caniuseresult"></a>
|
|
423
|
-
### CanIUseResult
|
|
424
|
-
|
|
425
|
-
#### Properties
|
|
426
|
-
|
|
427
|
-
##### result
|
|
428
|
-
|
|
429
|
-
> **result**: `boolean`
|
|
430
|
-
|
|
431
|
-
<a id="getlocationparams"></a>
|
|
432
|
-
### GetLocationParams
|
|
433
|
-
|
|
434
|
-
#### Properties
|
|
435
|
-
|
|
436
|
-
##### maxCacheMs?
|
|
437
|
-
|
|
438
|
-
> `optional` **maxCacheMs**: `number`
|
|
439
|
-
|
|
440
|
-
缓存时间,单位毫秒,默认为0
|
|
441
|
-
|
|
442
|
-
##### mode?
|
|
443
|
-
|
|
444
|
-
> `optional` **mode**: `number`
|
|
445
|
-
|
|
446
|
-
定位模式
|
|
447
|
-
0:低功耗
|
|
448
|
-
1:仅设备
|
|
449
|
-
2:高精度(默认)
|
|
450
|
-
|
|
451
|
-
##### source?
|
|
452
|
-
|
|
453
|
-
> `optional` **source**: `string`
|
|
454
|
-
|
|
455
|
-
调用业务方
|
|
456
|
-
|
|
457
|
-
##### timeoutMs?
|
|
458
|
-
|
|
459
|
-
> `optional` **timeoutMs**: `number`
|
|
460
|
-
|
|
461
|
-
超时时间,单位毫秒,默认 30000
|
|
462
|
-
|
|
463
|
-
<a id="getlocationresponse"></a>
|
|
464
|
-
### GetLocationResponse
|
|
465
|
-
|
|
466
|
-
#### Properties
|
|
467
|
-
|
|
468
|
-
##### accuracy
|
|
469
|
-
|
|
470
|
-
> **accuracy**: `number`
|
|
471
|
-
|
|
472
|
-
定位精度,单位:米
|
|
473
|
-
|
|
474
|
-
##### latitude
|
|
475
|
-
|
|
476
|
-
> **latitude**: `number`
|
|
477
|
-
|
|
478
|
-
纬度
|
|
479
|
-
|
|
480
|
-
##### longitude
|
|
481
|
-
|
|
482
|
-
> **longitude**: `number`
|
|
483
|
-
|
|
484
|
-
经度
|
|
485
|
-
|
|
486
|
-
##### speed
|
|
487
|
-
|
|
488
|
-
> **speed**: `number`
|
|
489
|
-
|
|
490
|
-
行进速度,单位:米/秒
|
|
491
|
-
|
|
492
|
-
##### timestamp
|
|
493
|
-
|
|
494
|
-
> **timestamp**: `string`
|
|
495
|
-
|
|
496
|
-
时间戳
|
|
497
|
-
|
|
498
|
-
<a id="loginrequest"></a>
|
|
499
|
-
### LoginRequest
|
|
500
|
-
|
|
501
|
-
#### Properties
|
|
502
|
-
|
|
503
|
-
##### timeout?
|
|
504
|
-
|
|
505
|
-
> `optional` **timeout**: `number`
|
|
506
|
-
|
|
507
|
-
Timeout in milliseconds
|
|
508
|
-
|
|
509
|
-
<a id="loginresult"></a>
|
|
510
|
-
### LoginResult
|
|
511
|
-
|
|
512
|
-
#### Properties
|
|
513
|
-
|
|
514
|
-
##### code
|
|
515
|
-
|
|
516
|
-
> **code**: `string`
|
|
517
|
-
|
|
518
|
-
Login credential code
|
|
519
|
-
|
|
520
|
-
<a id="getwindowinforesult"></a>
|
|
521
|
-
### GetWindowInfoResult
|
|
522
|
-
|
|
523
|
-
#### Properties
|
|
524
|
-
|
|
525
|
-
##### pixelRatio
|
|
526
|
-
|
|
527
|
-
> **pixelRatio**: `number`
|
|
528
|
-
|
|
529
|
-
设备像素比
|
|
530
|
-
|
|
531
|
-
##### safeArea?
|
|
532
|
-
|
|
533
|
-
> `optional` **safeArea**: [`WindowSafeArea`](#windowsafearea)
|
|
534
|
-
|
|
535
|
-
安全区域
|
|
536
|
-
|
|
537
|
-
##### screenHeight
|
|
538
|
-
|
|
539
|
-
> **screenHeight**: `number`
|
|
540
|
-
|
|
541
|
-
屏幕高度
|
|
542
|
-
|
|
543
|
-
##### screenTop
|
|
544
|
-
|
|
545
|
-
> **screenTop**: `number`
|
|
546
|
-
|
|
547
|
-
窗口上边缘的 y 值
|
|
548
|
-
|
|
549
|
-
##### screenWidth
|
|
550
|
-
|
|
551
|
-
> **screenWidth**: `number`
|
|
552
|
-
|
|
553
|
-
屏幕宽度
|
|
554
|
-
|
|
555
|
-
##### statusBarHeight
|
|
556
|
-
|
|
557
|
-
> **statusBarHeight**: `number`
|
|
558
|
-
|
|
559
|
-
状态栏高度
|
|
560
|
-
|
|
561
|
-
##### windowHeight
|
|
562
|
-
|
|
563
|
-
> **windowHeight**: `number`
|
|
564
|
-
|
|
565
|
-
可使用窗口高度
|
|
566
|
-
|
|
567
|
-
##### windowWidth
|
|
568
|
-
|
|
569
|
-
> **windowWidth**: `number`
|
|
570
|
-
|
|
571
|
-
可使用窗口宽度
|
|
572
|
-
|
|
573
|
-
<a id="windowsafearea"></a>
|
|
574
|
-
### WindowSafeArea
|
|
575
|
-
|
|
576
|
-
#### Properties
|
|
577
|
-
|
|
578
|
-
##### bottom
|
|
579
|
-
|
|
580
|
-
> **bottom**: `number`
|
|
581
|
-
|
|
582
|
-
安全区域右下角纵坐标
|
|
583
|
-
|
|
584
|
-
##### height
|
|
585
|
-
|
|
586
|
-
> **height**: `number`
|
|
587
|
-
|
|
588
|
-
安全区域高度
|
|
589
|
-
|
|
590
|
-
##### left
|
|
591
|
-
|
|
592
|
-
> **left**: `number`
|
|
593
|
-
|
|
594
|
-
安全区域左上角横坐标
|
|
595
|
-
|
|
596
|
-
##### right
|
|
597
|
-
|
|
598
|
-
> **right**: `number`
|
|
599
|
-
|
|
600
|
-
安全区域右下角横坐标
|
|
601
|
-
|
|
602
|
-
##### top
|
|
603
|
-
|
|
604
|
-
> **top**: `number`
|
|
605
|
-
|
|
606
|
-
安全区域左上角纵坐标
|
|
607
|
-
|
|
608
|
-
##### width
|
|
609
|
-
|
|
610
|
-
> **width**: `number`
|
|
611
|
-
|
|
612
|
-
安全区域宽度
|
|
613
|
-
|
|
614
|
-
<a id="getsystemsettingresult"></a>
|
|
615
|
-
### GetSystemSettingResult
|
|
616
|
-
|
|
617
|
-
#### Properties
|
|
618
|
-
|
|
619
|
-
##### bluetoothEnabled
|
|
620
|
-
|
|
621
|
-
> **bluetoothEnabled**: `boolean`
|
|
622
|
-
|
|
623
|
-
蓝牙的系统开关
|
|
624
|
-
|
|
625
|
-
##### deviceOrientation
|
|
626
|
-
|
|
627
|
-
> **deviceOrientation**: [`DeviceOrientation`](#deviceorientation-1)
|
|
628
|
-
|
|
629
|
-
设备方向
|
|
630
|
-
|
|
631
|
-
##### locationEnabled
|
|
632
|
-
|
|
633
|
-
> **locationEnabled**: `boolean`
|
|
634
|
-
|
|
635
|
-
地理位置的系统开关
|
|
636
|
-
|
|
637
|
-
##### wifiEnabled
|
|
638
|
-
|
|
639
|
-
> **wifiEnabled**: `boolean`
|
|
640
|
-
|
|
641
|
-
Wi-Fi 的系统开关
|
|
642
|
-
|
|
643
|
-
<a id="deviceorientation-1"></a>
|
|
644
|
-
<a id="deviceorientation"></a>
|
|
645
|
-
### DeviceOrientation
|
|
646
|
-
|
|
647
|
-
> **DeviceOrientation**: `"portrait"` \| `"landscape"`
|
|
648
|
-
|
|
649
|
-
<a id="getappbaseinforesult"></a>
|
|
650
|
-
### GetAppBaseInfoResult
|
|
651
|
-
|
|
652
|
-
#### Properties
|
|
653
|
-
|
|
654
|
-
##### SDKVersion?
|
|
655
|
-
|
|
656
|
-
> `optional` **SDKVersion**: `string`
|
|
657
|
-
|
|
658
|
-
客户端基础库版本
|
|
659
|
-
|
|
660
|
-
##### enableDebug?
|
|
661
|
-
|
|
662
|
-
> `optional` **enableDebug**: `boolean`
|
|
663
|
-
|
|
664
|
-
是否已打开调试
|
|
665
|
-
|
|
666
|
-
##### host?
|
|
667
|
-
|
|
668
|
-
> `optional` **host**: [`AppBaseInfoHost`](#appbaseinfohost)
|
|
669
|
-
|
|
670
|
-
当前豆包 App运行的宿主环境
|
|
671
|
-
|
|
672
|
-
##### language
|
|
673
|
-
|
|
674
|
-
> **language**: `string`
|
|
675
|
-
|
|
676
|
-
当前语言
|
|
677
|
-
|
|
678
|
-
##### theme?
|
|
679
|
-
|
|
680
|
-
> `optional` **theme**: `"light"` \| `"dark"`
|
|
681
|
-
|
|
682
|
-
当前主题
|
|
683
|
-
|
|
684
|
-
##### version?
|
|
685
|
-
|
|
686
|
-
> `optional` **version**: `string`
|
|
687
|
-
|
|
688
|
-
宿主版本号
|
|
689
|
-
|
|
690
|
-
<a id="appbaseinfohost"></a>
|
|
691
|
-
### AppBaseInfoHost
|
|
692
|
-
|
|
693
|
-
#### Properties
|
|
694
|
-
|
|
695
|
-
##### appId
|
|
696
|
-
|
|
697
|
-
> **appId**: `string`
|
|
698
|
-
|
|
699
|
-
宿主 app 对应的 appId
|