Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
d87d33e6
D
Docs
项目概览
OpenHarmony
/
Docs
1 年多 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
d87d33e6
编写于
8月 28, 2023
作者:
C
chenshixu1
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixed
83cf4acd
from
https://gitee.com/chen-shixu-1/docs/pulls/23190
fix ark Signed-off-by:
N
chenshixu1
<
chenshixu1@h-partners.com
>
上级
502dce4a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
24 addition
and
22 deletion
+24
-22
zh-cn/application-dev/reference/apis/js-apis-system-parameter.md
...pplication-dev/reference/apis/js-apis-system-parameter.md
+12
-11
zh-cn/application-dev/reference/apis/js-apis-system-parameterEnhance.md
...ion-dev/reference/apis/js-apis-system-parameterEnhance.md
+12
-11
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-system-parameter.md
浏览文件 @
d87d33e6
...
@@ -14,7 +14,8 @@
...
@@ -14,7 +14,8 @@
## 导入模块
## 导入模块
```
ts
```
ts
import
systemparameter
from
'
@ohos.systemparameter
'
import
systemparameter
from
'
@ohos.systemparameter
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
```
```
## systemparameter.getSync<sup>(deprecated)</sup>
## systemparameter.getSync<sup>(deprecated)</sup>
...
@@ -42,7 +43,7 @@ getSync(key: string, def?: string): string
...
@@ -42,7 +43,7 @@ getSync(key: string, def?: string): string
```
ts
```
ts
try
{
try
{
var
info
=
systemparameter
.
getSync
(
"
const.ohos.apiversion
"
);
let
info
=
systemparameter
.
getSync
(
"
const.ohos.apiversion
"
);
console
.
log
(
JSON
.
stringify
(
info
));
console
.
log
(
JSON
.
stringify
(
info
));
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
"
getSync unexpected error:
"
+
e
);
console
.
log
(
"
getSync unexpected error:
"
+
e
);
...
@@ -68,7 +69,7 @@ get(key: string, callback: AsyncCallback<string>): void
...
@@ -68,7 +69,7 @@ get(key: string, callback: AsyncCallback<string>): void
```
ts
```
ts
try
{
try
{
systemparameter
.
get
(
"
const.ohos.apiversion
"
,
function
(
err
,
data
)
{
systemparameter
.
get
(
"
const.ohos.apiversion
"
,
(
err
:
BusinessError
,
data
:
string
)
=>
{
if
(
err
==
undefined
)
{
if
(
err
==
undefined
)
{
console
.
log
(
"
get test.parameter.key value success:
"
+
data
)
console
.
log
(
"
get test.parameter.key value success:
"
+
data
)
}
else
{
}
else
{
...
@@ -99,7 +100,7 @@ get(key: string, def: string, callback: AsyncCallback<string>): void
...
@@ -99,7 +100,7 @@ get(key: string, def: string, callback: AsyncCallback<string>): void
```
ts
```
ts
try
{
try
{
systemparameter
.
get
(
"
const.ohos.apiversion
"
,
"
default
"
,
function
(
err
,
data
)
{
systemparameter
.
get
(
"
const.ohos.apiversion
"
,
"
default
"
,
(
err
:
BusinessError
,
data
:
string
)
=>
{
if
(
err
==
undefined
)
{
if
(
err
==
undefined
)
{
console
.
log
(
"
get test.parameter.key value success:
"
+
data
)
console
.
log
(
"
get test.parameter.key value success:
"
+
data
)
}
else
{
}
else
{
...
@@ -136,10 +137,10 @@ get(key: string, def?: string): Promise<string>
...
@@ -136,10 +137,10 @@ get(key: string, def?: string): Promise<string>
```
ts
```
ts
try
{
try
{
var
p
=
systemparameter
.
get
(
"
const.ohos.apiversion
"
);
let
p
=
systemparameter
.
get
(
"
const.ohos.apiversion
"
);
p
.
then
(
function
(
value
)
{
p
.
then
(
(
value
:
string
)
=>
{
console
.
log
(
"
get test.parameter.key success:
"
+
value
);
console
.
log
(
"
get test.parameter.key success:
"
+
value
);
}).
catch
(
function
(
err
)
{
}).
catch
(
(
err
:
BusinessError
)
=>
{
console
.
log
(
"
get test.parameter.key error:
"
+
err
.
code
);
console
.
log
(
"
get test.parameter.key error:
"
+
err
.
code
);
});
});
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -201,7 +202,7 @@ set(key: string, value: string, callback: AsyncCallback<void>): void
...
@@ -201,7 +202,7 @@ set(key: string, value: string, callback: AsyncCallback<void>): void
```
ts
```
ts
try
{
try
{
systemparameter
.
set
(
"
test.parameter.key
"
,
"
testValue
"
,
function
(
err
,
data
)
{
systemparameter
.
set
(
"
test.parameter.key
"
,
"
testValue
"
,
(
err
:
BusinessError
,
data
:
string
)
=>
{
if
(
err
==
undefined
)
{
if
(
err
==
undefined
)
{
console
.
log
(
"
set test.parameter.key value success :
"
+
data
)
console
.
log
(
"
set test.parameter.key value success :
"
+
data
)
}
else
{
}
else
{
...
@@ -241,10 +242,10 @@ set(key: string, value: string): Promise<void>
...
@@ -241,10 +242,10 @@ set(key: string, value: string): Promise<void>
```
ts
```
ts
try
{
try
{
var
p
=
systemparameter
.
set
(
"
test.parameter.key
"
,
"
testValue
"
);
let
p
=
systemparameter
.
set
(
"
test.parameter.key
"
,
"
testValue
"
);
p
.
then
(
function
(
value
)
{
p
.
then
(
(
value
:
string
)
=>
{
console
.
log
(
"
set test.parameter.key success:
"
+
value
);
console
.
log
(
"
set test.parameter.key success:
"
+
value
);
}).
catch
(
function
(
err
)
{
}).
catch
(
(
err
:
BusinessError
)
=>
{
console
.
log
(
"
set test.parameter.key error:
"
+
err
.
code
);
console
.
log
(
"
set test.parameter.key error:
"
+
err
.
code
);
});
});
}
catch
(
e
)
{
}
catch
(
e
)
{
...
...
zh-cn/application-dev/reference/apis/js-apis-system-parameterEnhance.md
浏览文件 @
d87d33e6
...
@@ -13,7 +13,8 @@
...
@@ -13,7 +13,8 @@
## 导入模块
## 导入模块
```
ts
```
ts
import
systemparameter
from
'
@ohos.systemParameterEnhance
'
import
systemparameter
from
'
@ohos.systemParameterEnhance
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
```
```
## systemparameter.getSync
## systemparameter.getSync
...
@@ -41,7 +42,7 @@ getSync(key: string, def?: string): string
...
@@ -41,7 +42,7 @@ getSync(key: string, def?: string): string
```
ts
```
ts
try
{
try
{
var
info
=
systemparameter
.
getSync
(
"
const.ohos.apiversion
"
);
let
info
=
systemparameter
.
getSync
(
"
const.ohos.apiversion
"
);
console
.
log
(
JSON
.
stringify
(
info
));
console
.
log
(
JSON
.
stringify
(
info
));
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
"
getSync unexpected error:
"
+
e
);
console
.
log
(
"
getSync unexpected error:
"
+
e
);
...
@@ -67,7 +68,7 @@ get(key: string, callback: AsyncCallback<string>): void
...
@@ -67,7 +68,7 @@ get(key: string, callback: AsyncCallback<string>): void
```
ts
```
ts
try
{
try
{
systemparameter
.
get
(
"
const.ohos.apiversion
"
,
function
(
err
,
data
)
{
systemparameter
.
get
(
"
const.ohos.apiversion
"
,
(
err
:
BusinessError
,
data
:
string
)
=>
{
if
(
err
==
undefined
)
{
if
(
err
==
undefined
)
{
console
.
log
(
"
get test.parameter.key value success:
"
+
data
)
console
.
log
(
"
get test.parameter.key value success:
"
+
data
)
}
else
{
}
else
{
...
@@ -98,7 +99,7 @@ get(key: string, def: string, callback: AsyncCallback<string>): void
...
@@ -98,7 +99,7 @@ get(key: string, def: string, callback: AsyncCallback<string>): void
```
ts
```
ts
try
{
try
{
systemparameter
.
get
(
"
const.ohos.apiversion
"
,
"
default
"
,
function
(
err
,
data
)
{
systemparameter
.
get
(
"
const.ohos.apiversion
"
,
"
default
"
,
(
err
:
BusinessError
,
data
:
string
)
=>
{
if
(
err
==
undefined
)
{
if
(
err
==
undefined
)
{
console
.
log
(
"
get test.parameter.key value success:
"
+
data
)
console
.
log
(
"
get test.parameter.key value success:
"
+
data
)
}
else
{
}
else
{
...
@@ -135,10 +136,10 @@ get(key: string, def?: string): Promise<string>
...
@@ -135,10 +136,10 @@ get(key: string, def?: string): Promise<string>
```
ts
```
ts
try
{
try
{
var
p
=
systemparameter
.
get
(
"
const.ohos.apiversion
"
);
let
p
=
systemparameter
.
get
(
"
const.ohos.apiversion
"
);
p
.
then
(
function
(
value
)
{
p
.
then
(
(
value
:
string
)
=>
{
console
.
log
(
"
get test.parameter.key success:
"
+
value
);
console
.
log
(
"
get test.parameter.key success:
"
+
value
);
}).
catch
(
function
(
err
)
{
}).
catch
(
(
err
:
BusinessError
)
=>
{
console
.
log
(
"
get test.parameter.key error:
"
+
err
.
code
);
console
.
log
(
"
get test.parameter.key error:
"
+
err
.
code
);
});
});
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -191,7 +192,7 @@ set(key: string, value: string, callback: AsyncCallback<void>): void
...
@@ -191,7 +192,7 @@ set(key: string, value: string, callback: AsyncCallback<void>): void
```
ts
```
ts
try
{
try
{
systemparameter
.
set
(
"
test.parameter.key
"
,
"
testValue
"
,
function
(
err
,
data
)
{
systemparameter
.
set
(
"
test.parameter.key
"
,
"
testValue
"
,
(
err
:
BusinessError
,
data
:
string
)
=>
{
if
(
err
==
undefined
)
{
if
(
err
==
undefined
)
{
console
.
log
(
"
set test.parameter.key value success :
"
+
data
)
console
.
log
(
"
set test.parameter.key value success :
"
+
data
)
}
else
{
}
else
{
...
@@ -227,10 +228,10 @@ set(key: string, value: string): Promise<void>
...
@@ -227,10 +228,10 @@ set(key: string, value: string): Promise<void>
```
ts
```
ts
try
{
try
{
var
p
=
systemparameter
.
set
(
"
test.parameter.key
"
,
"
testValue
"
);
let
p
=
systemparameter
.
set
(
"
test.parameter.key
"
,
"
testValue
"
);
p
.
then
(
function
(
value
)
{
p
.
then
(
(
value
:
string
)
=>
{
console
.
log
(
"
set test.parameter.key success:
"
+
value
);
console
.
log
(
"
set test.parameter.key success:
"
+
value
);
}).
catch
(
function
(
err
)
{
}).
catch
(
(
err
:
BusinessError
)
=>
{
console
.
log
(
"
set test.parameter.key error:
"
+
err
.
code
);
console
.
log
(
"
set test.parameter.key error:
"
+
err
.
code
);
});
});
}
catch
(
e
)
{
}
catch
(
e
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录