Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
73180797
D
Docs
项目概览
OpenHarmony
/
Docs
大约 2 年 前同步成功
通知
161
Star
293
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看板
未验证
提交
73180797
编写于
4月 29, 2022
作者:
O
openharmony_ci
提交者:
Gitee
4月 29, 2022
浏览文件
操作
浏览文件
下载
差异文件
!3548 Modify the sample code language tag type for language compilation runtime
Merge pull request !3548 from 李兴阳/master
上级
3e0d9f74
52d88c79
变更
12
展开全部
隐藏空白更改
内联
并排
Showing
12 changed file
with
1313 addition
and
1310 deletion
+1313
-1310
en/application-dev/reference/apis/js-apis-convertxml.md
en/application-dev/reference/apis/js-apis-convertxml.md
+1
-1
en/application-dev/reference/apis/js-apis-process.md
en/application-dev/reference/apis/js-apis-process.md
+23
-23
en/application-dev/reference/apis/js-apis-uri.md
en/application-dev/reference/apis/js-apis-uri.md
+6
-6
en/application-dev/reference/apis/js-apis-url.md
en/application-dev/reference/apis/js-apis-url.md
+17
-17
en/application-dev/reference/apis/js-apis-util.md
en/application-dev/reference/apis/js-apis-util.md
+595
-594
en/application-dev/reference/apis/js-apis-xml.md
en/application-dev/reference/apis/js-apis-xml.md
+14
-14
zh-cn/application-dev/reference/apis/js-apis-convertxml.md
zh-cn/application-dev/reference/apis/js-apis-convertxml.md
+1
-1
zh-cn/application-dev/reference/apis/js-apis-process.md
zh-cn/application-dev/reference/apis/js-apis-process.md
+24
-23
zh-cn/application-dev/reference/apis/js-apis-uri.md
zh-cn/application-dev/reference/apis/js-apis-uri.md
+6
-6
zh-cn/application-dev/reference/apis/js-apis-url.md
zh-cn/application-dev/reference/apis/js-apis-url.md
+17
-17
zh-cn/application-dev/reference/apis/js-apis-util.md
zh-cn/application-dev/reference/apis/js-apis-util.md
+595
-594
zh-cn/application-dev/reference/apis/js-apis-xml.md
zh-cn/application-dev/reference/apis/js-apis-xml.md
+14
-14
未找到文件。
en/application-dev/reference/apis/js-apis-convertxml.md
浏览文件 @
73180797
...
@@ -39,7 +39,7 @@ Converts an XML text into a JavaScript object.
...
@@ -39,7 +39,7 @@ Converts an XML text into a JavaScript object.
-
Example
-
Example
```
```
js
let
xml
=
let
xml
=
'
<?xml version="1.0" encoding="utf-8"?>
'
+
'
<?xml version="1.0" encoding="utf-8"?>
'
+
'
<note importance="high" logged="true">
'
+
'
<note importance="high" logged="true">
'
+
...
...
en/application-dev/reference/apis/js-apis-process.md
浏览文件 @
73180797
...
@@ -60,7 +60,7 @@ Waits until the child process ends. This method uses a promise to return the exi
...
@@ -60,7 +60,7 @@ Waits until the child process ends. This method uses a promise to return the exi
**Example**
**Example**
```
```
js
var
child
=
process
.
runCmd
(
'
ls
'
);
var
child
=
process
.
runCmd
(
'
ls
'
);
var
result
=
child
.
wait
();
var
result
=
child
.
wait
();
result
.
then
(
val
=>
{
result
.
then
(
val
=>
{
...
@@ -85,7 +85,7 @@ Obtains the standard output of the child process.
...
@@ -85,7 +85,7 @@ Obtains the standard output of the child process.
**Example**
**Example**
```
```
js
var
child
=
process
.
runCmd
(
'
ls
'
);
var
child
=
process
.
runCmd
(
'
ls
'
);
var
result
=
child
.
wait
();
var
result
=
child
.
wait
();
child
.
getOutput
.
then
(
val
=>
{
child
.
getOutput
.
then
(
val
=>
{
...
@@ -110,7 +110,7 @@ Obtains the standard error output of the child process.
...
@@ -110,7 +110,7 @@ Obtains the standard error output of the child process.
**Example**
**Example**
```
```
js
var
child
=
process
.
runCmd
(
'
madir test.text
'
);
var
child
=
process
.
runCmd
(
'
madir test.text
'
);
var
result
=
child
.
wait
();
var
result
=
child
.
wait
();
child
.
getErrorOutput
.
then
(
val
=>
{
child
.
getErrorOutput
.
then
(
val
=>
{
...
@@ -129,7 +129,7 @@ Closes the child process in running.
...
@@ -129,7 +129,7 @@ Closes the child process in running.
**Example**
**Example**
```
```
js
var
child
=
process
.
runCmd
(
'
sleep 5; ls
'
);
var
child
=
process
.
runCmd
(
'
sleep 5; ls
'
);
child
.
close
();
child
.
close
();
```
```
...
@@ -151,7 +151,7 @@ Sends a signal to the specified child process to terminate it.
...
@@ -151,7 +151,7 @@ Sends a signal to the specified child process to terminate it.
**Example**
**Example**
```
```
js
var
child
=
process
.
runCmd
(
'
sleep 5; ls
'
);
var
child
=
process
.
runCmd
(
'
sleep 5; ls
'
);
child
.
kill
(
9
);
child
.
kill
(
9
);
```
```
...
@@ -173,7 +173,7 @@ Checks whether this process is isolated.
...
@@ -173,7 +173,7 @@ Checks whether this process is isolated.
**Example**
**Example**
```
```
js
var
result
=
process
.
isIsolatedProcess
();
var
result
=
process
.
isIsolatedProcess
();
```
```
...
@@ -200,7 +200,7 @@ Checks whether a UID belongs to this app.
...
@@ -200,7 +200,7 @@ Checks whether a UID belongs to this app.
**Example**
**Example**
```
```
js
var
result
=
process
.
isAppUid
(
688
);
var
result
=
process
.
isAppUid
(
688
);
```
```
...
@@ -221,7 +221,7 @@ Checks whether this process is running in a 64-bit environment.
...
@@ -221,7 +221,7 @@ Checks whether this process is running in a 64-bit environment.
**Example**
**Example**
```
```
js
var
ressult
=
process
.
is64Bit
();
var
ressult
=
process
.
is64Bit
();
```
```
...
@@ -248,7 +248,7 @@ Obtains the process UID based on the process name.
...
@@ -248,7 +248,7 @@ Obtains the process UID based on the process name.
**Example**
**Example**
```
```
js
var
pres
=
process
.
getUidForName
(
"
tool
"
)
var
pres
=
process
.
getUidForName
(
"
tool
"
)
```
```
...
@@ -275,7 +275,7 @@ Obtains the thread priority based on the specified TID.
...
@@ -275,7 +275,7 @@ Obtains the thread priority based on the specified TID.
**Example**
**Example**
```
```
js
var
tid
=
process
.
getTid
();
var
tid
=
process
.
getTid
();
var
pres
=
process
.
getThreadPriority
(
tid
);
var
pres
=
process
.
getThreadPriority
(
tid
);
```
```
...
@@ -297,7 +297,7 @@ Obtains the duration, in milliseconds, from the time the system starts to the ti
...
@@ -297,7 +297,7 @@ Obtains the duration, in milliseconds, from the time the system starts to the ti
**Example**
**Example**
```
```
js
var
realtime
=
process
.
getStartRealtime
();
var
realtime
=
process
.
getStartRealtime
();
```
```
...
@@ -317,7 +317,7 @@ Obtains the CPU time (in milliseconds) from the time the process starts to the c
...
@@ -317,7 +317,7 @@ Obtains the CPU time (in milliseconds) from the time the process starts to the c
**Example**
**Example**
```
```
js
var
result
=
process
.
getPastCpuTime
()
;
var
result
=
process
.
getPastCpuTime
()
;
```
```
...
@@ -344,7 +344,7 @@ Obtains the system configuration.
...
@@ -344,7 +344,7 @@ Obtains the system configuration.
**Example**
**Example**
```
```
js
var
_SC_ARG_MAX
=
0
var
_SC_ARG_MAX
=
0
var
pres
=
process
.
getSystemConfig
(
_SC_ARG_MAX
)
var
pres
=
process
.
getSystemConfig
(
_SC_ARG_MAX
)
```
```
...
@@ -372,7 +372,7 @@ Obtains the value of an environment variable.
...
@@ -372,7 +372,7 @@ Obtains the value of an environment variable.
**Example**
**Example**
```
```
js
var
pres
=
process
.
getEnvironmentVar
(
"
PATH
"
)
var
pres
=
process
.
getEnvironmentVar
(
"
PATH
"
)
```
```
...
@@ -408,7 +408,7 @@ Forks a new process to run a shell command and returns the **ChildProcess** obje
...
@@ -408,7 +408,7 @@ Forks a new process to run a shell command and returns the **ChildProcess** obje
**Example**
**Example**
```
```
js
var
child
=
process
.
runCmd
(
'
ls
'
,
{
maxBuffer
:
2
});
var
child
=
process
.
runCmd
(
'
ls
'
,
{
maxBuffer
:
2
});
var
result
=
child
.
wait
();
var
result
=
child
.
wait
();
child
.
getOutput
.
then
(
val
=>
{
child
.
getOutput
.
then
(
val
=>
{
...
@@ -427,7 +427,7 @@ Aborts a process and generates a core file. This method will cause a process to
...
@@ -427,7 +427,7 @@ Aborts a process and generates a core file. This method will cause a process to
**Example**
**Example**
```
```
js
process
.
abort
();
process
.
abort
();
```
```
...
@@ -455,7 +455,7 @@ Stores the events triggered by the user.
...
@@ -455,7 +455,7 @@ Stores the events triggered by the user.
**Example**
**Example**
```
```
js
process
.
on
(
"
data
"
,
(
e
)
=>
{
process
.
on
(
"
data
"
,
(
e
)
=>
{
console
.
log
(
"
data callback
"
);
console
.
log
(
"
data callback
"
);
})
})
...
@@ -484,7 +484,7 @@ Deletes the event stored by the user.
...
@@ -484,7 +484,7 @@ Deletes the event stored by the user.
**Example**
**Example**
```
```
js
process
.
on
(
"
data
"
,
(
e
)
=>
{
process
.
on
(
"
data
"
,
(
e
)
=>
{
console
.
log
(
"
data callback
"
);
console
.
log
(
"
data callback
"
);
})
})
...
@@ -510,7 +510,7 @@ Exercise caution when using this API.
...
@@ -510,7 +510,7 @@ Exercise caution when using this API.
**Example**
**Example**
```
```
js
process
.
exit
(
0
);
process
.
exit
(
0
);
```
```
...
@@ -525,7 +525,7 @@ Obtains the working directory of this process.
...
@@ -525,7 +525,7 @@ Obtains the working directory of this process.
**Example**
**Example**
```
```
js
var
path
=
process
.
cwd
();
var
path
=
process
.
cwd
();
```
```
...
@@ -546,7 +546,7 @@ Changes the working directory of this process.
...
@@ -546,7 +546,7 @@ Changes the working directory of this process.
**Example**
**Example**
```
```
js
process
.
chdir
(
'
/system
'
);
process
.
chdir
(
'
/system
'
);
```
```
...
@@ -567,7 +567,7 @@ Obtains the running time of this process.
...
@@ -567,7 +567,7 @@ Obtains the running time of this process.
**Example**
**Example**
```
```
js
var
time
=
process
.
uptime
();
var
time
=
process
.
uptime
();
```
```
...
@@ -594,7 +594,7 @@ Sends a signal to the specified process to terminate it.
...
@@ -594,7 +594,7 @@ Sends a signal to the specified process to terminate it.
| boolean | Returns
**true**
if the signal is sent successfully; returns
**false**
otherwise.|
| boolean | Returns
**true**
if the signal is sent successfully; returns
**false**
otherwise.|
**Example**
**Example**
```
```
js
var
pres
=
process
.
pid
var
pres
=
process
.
pid
var
result
=
that
.
kill
(
pres
,
28
)
var
result
=
that
.
kill
(
pres
,
28
)
```
```
en/application-dev/reference/apis/js-apis-uri.md
浏览文件 @
73180797
...
@@ -46,11 +46,11 @@ A constructor used to create a URI instance.
...
@@ -46,11 +46,11 @@ A constructor used to create a URI instance.
**Example**
**Example**
```
```
js
var
mm
=
'
http://username:password@host:8080/directory/file?foo=1&bar=2#fragment
'
;
var
mm
=
'
http://username:password@host:8080/directory/file?foo=1&bar=2#fragment
'
;
new
uri
.
URI
(
mm
);
// Output 'http://username:password@host:8080/directory/file?foo=1&bar=2#fragment';
new
uri
.
URI
(
mm
);
// Output 'http://username:password@host:8080/directory/file?foo=1&bar=2#fragment';
```
```
```
```
js
new
uri
.
URI
(
'
http://username:password@host:8080
'
);
// Output 'http://username:password@host:8080';
new
uri
.
URI
(
'
http://username:password@host:8080
'
);
// Output 'http://username:password@host:8080';
```
```
...
@@ -69,7 +69,7 @@ Obtains the query string applicable to this URL.
...
@@ -69,7 +69,7 @@ Obtains the query string applicable to this URL.
**Example**
**Example**
```
```
js
const
url
=
new
uri
.
URL
(
'
http://username:password@host:8080/directory/file?query=pppppp#qwer=da
'
);
const
url
=
new
uri
.
URL
(
'
http://username:password@host:8080/directory/file?query=pppppp#qwer=da
'
);
url
.
toString
()
url
.
toString
()
```
```
...
@@ -95,7 +95,7 @@ Checks whether this URI is the same as another URI object.
...
@@ -95,7 +95,7 @@ Checks whether this URI is the same as another URI object.
**Example**
**Example**
```
```
js
const
uriInstance
=
new
uri
.
URI
(
'
http://username:password@host:8080/directory/file?query=pppppp#qwer=da
'
);
const
uriInstance
=
new
uri
.
URI
(
'
http://username:password@host:8080/directory/file?query=pppppp#qwer=da
'
);
const
uriInstance1
=
new
uri
.
URI
(
'
http://username:password@host:8080/directory/file?query=pppppp#qwer=da#fragment
'
);
const
uriInstance1
=
new
uri
.
URI
(
'
http://username:password@host:8080/directory/file?query=pppppp#qwer=da#fragment
'
);
uriInstance
.
equals
(
uriInstance1
);
uriInstance
.
equals
(
uriInstance1
);
...
@@ -115,7 +115,7 @@ Checks whether this URI is an absolute URI (whether the scheme component is defi
...
@@ -115,7 +115,7 @@ Checks whether this URI is an absolute URI (whether the scheme component is defi
**Example**
**Example**
```
```
js
const
uriInstance
=
new
uri
.
URI
(
'
http://username:password@www.qwer.com:8080?query=pppppp
'
);
const
uriInstance
=
new
uri
.
URI
(
'
http://username:password@www.qwer.com:8080?query=pppppp
'
);
uriInstance
.
checkIsAbsolute
();
uriInstance
.
checkIsAbsolute
();
```
```
...
@@ -134,7 +134,7 @@ Normalizes the path of this URI.
...
@@ -134,7 +134,7 @@ Normalizes the path of this URI.
| URI | URI with the normalized path.|
| URI | URI with the normalized path.|
**Example**
**Example**
```
```
js
const
uriInstance
=
new
uri
.
URI
(
'
http://username:password@www.qwer.com:8080/path/path1/../path2/./path3?query=pppppp
'
);
const
uriInstance
=
new
uri
.
URI
(
'
http://username:password@www.qwer.com:8080/path/path1/../path2/./path3?query=pppppp
'
);
let
uriInstance1
=
uriInstance
.
normalize
();
let
uriInstance1
=
uriInstance
.
normalize
();
uriInstance1
.
path
;
uriInstance1
.
path
;
...
...
en/application-dev/reference/apis/js-apis-url.md
浏览文件 @
73180797
...
@@ -31,7 +31,7 @@ Creates a **URLSearchParams** instance.
...
@@ -31,7 +31,7 @@ Creates a **URLSearchParams** instance.
**Example**
**Example**
```
```
js
var
objectParams
=
new
URLSearchParams
([
[
'
user1
'
,
'
abc1
'
],
[
'
query2
'
,
'
first2
'
],
[
'
query3
'
,
'
second3
'
]
]);
var
objectParams
=
new
URLSearchParams
([
[
'
user1
'
,
'
abc1
'
],
[
'
query2
'
,
'
first2
'
],
[
'
query3
'
,
'
second3
'
]
]);
var
objectParams1
=
new
URLSearchParams
({
"
fod
"
:
1
,
"
bard
"
:
2
});
var
objectParams1
=
new
URLSearchParams
({
"
fod
"
:
1
,
"
bard
"
:
2
});
var
objectParams2
=
new
URLSearchParams
(
'
?fod=1&bard=2
'
);
var
objectParams2
=
new
URLSearchParams
(
'
?fod=1&bard=2
'
);
...
@@ -55,7 +55,7 @@ Appends a key-value pair into the query string.
...
@@ -55,7 +55,7 @@ Appends a key-value pair into the query string.
**Example**
**Example**
```
```
js
let
urlObject
=
new
URL
(
'
https://developer.exampleUrl/?fod=1&bard=2
'
);
let
urlObject
=
new
URL
(
'
https://developer.exampleUrl/?fod=1&bard=2
'
);
let
paramsObject
=
new
URLSearchParams
(
urlObject
.
search
.
slice
(
1
));
let
paramsObject
=
new
URLSearchParams
(
urlObject
.
search
.
slice
(
1
));
paramsObject
.
append
(
'
fod
'
,
3
);
paramsObject
.
append
(
'
fod
'
,
3
);
...
@@ -76,7 +76,7 @@ Deletes key-value pairs of the specified key.
...
@@ -76,7 +76,7 @@ Deletes key-value pairs of the specified key.
**Example**
**Example**
```
```
js
let
urlObject
=
new
URL
(
'
https://developer.exampleUrl/?fod=1&bard=2
'
);
let
urlObject
=
new
URL
(
'
https://developer.exampleUrl/?fod=1&bard=2
'
);
let
paramsobject
=
new
URLSearchParams
(
urlObject
.
search
.
slice
(
1
));
let
paramsobject
=
new
URLSearchParams
(
urlObject
.
search
.
slice
(
1
));
paramsobject
.
delete
(
'
fod
'
);
paramsobject
.
delete
(
'
fod
'
);
...
@@ -103,7 +103,7 @@ Obtains all the key-value pairs based on the specified key.
...
@@ -103,7 +103,7 @@ Obtains all the key-value pairs based on the specified key.
**Example**
**Example**
```
```
js
let
urlObject
=
new
URL
(
'
https://developer.exampleUrl/?fod=1&bard=2
'
);
let
urlObject
=
new
URL
(
'
https://developer.exampleUrl/?fod=1&bard=2
'
);
let
paramsObject
=
new
URLSearchParams
(
urlObject
.
search
.
slice
(
1
));
let
paramsObject
=
new
URLSearchParams
(
urlObject
.
search
.
slice
(
1
));
paramsObject
.
append
(
'
fod
'
,
3
);
// Add a second value for the fod parameter.
paramsObject
.
append
(
'
fod
'
,
3
);
// Add a second value for the fod parameter.
...
@@ -125,7 +125,7 @@ Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and th
...
@@ -125,7 +125,7 @@ Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and th
**Example**
**Example**
```
```
js
var
searchParamsObject
=
new
URLSearchParams
(
"
keyName1=valueName1&keyName2=valueName2
"
);
var
searchParamsObject
=
new
URLSearchParams
(
"
keyName1=valueName1&keyName2=valueName2
"
);
for
(
var
pair
of
searchParamsObject
.
entries
())
{
// Show keyName/valueName pairs
for
(
var
pair
of
searchParamsObject
.
entries
())
{
// Show keyName/valueName pairs
console
.
log
(
pair
[
0
]
+
'
,
'
+
pair
[
1
]);
console
.
log
(
pair
[
0
]
+
'
,
'
+
pair
[
1
]);
...
@@ -156,7 +156,7 @@ Traverses the key-value pairs in the **URLSearchParams** instance by using a cal
...
@@ -156,7 +156,7 @@ Traverses the key-value pairs in the **URLSearchParams** instance by using a cal
**Example**
**Example**
```
```
js
const
myURLObject
=
new
URL
(
'
https://developer.exampleUrl/?fod=1&bard=2
'
);
const
myURLObject
=
new
URL
(
'
https://developer.exampleUrl/?fod=1&bard=2
'
);
myURLObject
.
searchParams
.
forEach
((
value
,
name
,
searchParams
)
=>
{
myURLObject
.
searchParams
.
forEach
((
value
,
name
,
searchParams
)
=>
{
console
.
log
(
name
,
value
,
myURLObject
.
searchParams
===
searchParams
);
console
.
log
(
name
,
value
,
myURLObject
.
searchParams
===
searchParams
);
...
@@ -185,7 +185,7 @@ Obtains the value of the first key-value pair based on the specified key.
...
@@ -185,7 +185,7 @@ Obtains the value of the first key-value pair based on the specified key.
**Example**
**Example**
```
```
js
var
paramsOject
=
new
URLSearchParams
(
document
.
location
.
search
.
substring
(
1
));
var
paramsOject
=
new
URLSearchParams
(
document
.
location
.
search
.
substring
(
1
));
var
name
=
paramsOject
.
get
(
"
name
"
);
// is the string "Jonathan"
var
name
=
paramsOject
.
get
(
"
name
"
);
// is the string "Jonathan"
var
age
=
parseInt
(
paramsOject
.
get
(
"
age
"
),
10
);
// is the number 18
var
age
=
parseInt
(
paramsOject
.
get
(
"
age
"
),
10
);
// is the number 18
...
@@ -213,7 +213,7 @@ Checks whether a key has a value.
...
@@ -213,7 +213,7 @@ Checks whether a key has a value.
**Example**
**Example**
```
```
js
let
urlObject
=
new
URL
(
'
https://developer.exampleUrl/?fod=1&bard=2
'
);
let
urlObject
=
new
URL
(
'
https://developer.exampleUrl/?fod=1&bard=2
'
);
let
paramsObject
=
new
URLSearchParams
(
urlObject
.
search
.
slice
(
1
));
let
paramsObject
=
new
URLSearchParams
(
urlObject
.
search
.
slice
(
1
));
paramsObject
.
has
(
'
bard
'
)
===
true
;
paramsObject
.
has
(
'
bard
'
)
===
true
;
...
@@ -235,7 +235,7 @@ Sets the value for a key. If key-value pairs matching the specified key exist, t
...
@@ -235,7 +235,7 @@ Sets the value for a key. If key-value pairs matching the specified key exist, t
**Example**
**Example**
```
```
js
let
urlObject
=
new
URL
(
'
https://developer.exampleUrl/?fod=1&bard=2
'
);
let
urlObject
=
new
URL
(
'
https://developer.exampleUrl/?fod=1&bard=2
'
);
let
paramsObject
=
new
URLSearchParams
(
urlObject
.
search
.
slice
(
1
));
let
paramsObject
=
new
URLSearchParams
(
urlObject
.
search
.
slice
(
1
));
paramsObject
.
set
(
'
baz
'
,
3
);
// Add a third parameter.
paramsObject
.
set
(
'
baz
'
,
3
);
// Add a third parameter.
...
@@ -251,7 +251,7 @@ Sorts all key-value pairs contained in this object based on the Unicode code poi
...
@@ -251,7 +251,7 @@ Sorts all key-value pairs contained in this object based on the Unicode code poi
**Example**
**Example**
```
```
js
var
searchParamsObject
=
new
URLSearchParams
(
"
c=3&a=9&b=4&d=2
"
);
// Create a test URLSearchParams object
var
searchParamsObject
=
new
URLSearchParams
(
"
c=3&a=9&b=4&d=2
"
);
// Create a test URLSearchParams object
searchParamsObject
.
sort
();
// Sort the key/value pairs
searchParamsObject
.
sort
();
// Sort the key/value pairs
console
.
log
(
searchParamsObject
.
toString
());
// Display the sorted query string // Output a=9&b=2&c=3&d=4
console
.
log
(
searchParamsObject
.
toString
());
// Display the sorted query string // Output a=9&b=2&c=3&d=4
...
@@ -273,7 +273,7 @@ Obtains an ES6 iterator that contains the keys of all the key-value pairs.
...
@@ -273,7 +273,7 @@ Obtains an ES6 iterator that contains the keys of all the key-value pairs.
**Example**
**Example**
```
```
js
var
searchParamsObject
=
new
URLSearchParams
(
"
key1=value1&key2=value2
"
);
// Create a URLSearchParamsObject object for testing
var
searchParamsObject
=
new
URLSearchParams
(
"
key1=value1&key2=value2
"
);
// Create a URLSearchParamsObject object for testing
for
(
var
key
of
searchParamsObject
.
keys
())
{
// Output key-value pairs
for
(
var
key
of
searchParamsObject
.
keys
())
{
// Output key-value pairs
console
.
log
(
key
);
console
.
log
(
key
);
...
@@ -295,7 +295,7 @@ Obtains an ES6 iterator that contains the values of all the key-value pairs.
...
@@ -295,7 +295,7 @@ Obtains an ES6 iterator that contains the values of all the key-value pairs.
**Example**
**Example**
```
```
js
var
searchParams
=
new
URLSearchParams
(
"
key1=value1&key2=value2
"
);
// Create a URLSearchParamsObject object for testing
var
searchParams
=
new
URLSearchParams
(
"
key1=value1&key2=value2
"
);
// Create a URLSearchParamsObject object for testing
for
(
var
value
of
searchParams
.
values
())
{
for
(
var
value
of
searchParams
.
values
())
{
console
.
log
(
value
);
console
.
log
(
value
);
...
@@ -318,7 +318,7 @@ Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and th
...
@@ -318,7 +318,7 @@ Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and th
**Example**
**Example**
```
```
js
const
paramsObject
=
new
URLSearchParams
(
'
fod=bay&edg=bap
'
);
const
paramsObject
=
new
URLSearchParams
(
'
fod=bay&edg=bap
'
);
for
(
const
[
name
,
value
]
of
paramsObject
)
{
for
(
const
[
name
,
value
]
of
paramsObject
)
{
console
.
log
(
name
,
value
);
console
.
log
(
name
,
value
);
...
@@ -341,7 +341,7 @@ Obtains search parameters that are serialized as a string and, if necessary, per
...
@@ -341,7 +341,7 @@ Obtains search parameters that are serialized as a string and, if necessary, per
**Example**
**Example**
```
```
js
let
url
=
new
URL
(
'
https://developer.exampleUrl/?fod=1&bard=2
'
);
let
url
=
new
URL
(
'
https://developer.exampleUrl/?fod=1&bard=2
'
);
let
params
=
new
URLSearchParams
(
url
.
search
.
slice
(
1
));
let
params
=
new
URLSearchParams
(
url
.
search
.
slice
(
1
));
params
.
append
(
'
fod
'
,
3
);
params
.
append
(
'
fod
'
,
3
);
...
@@ -386,7 +386,7 @@ Creates a URL.
...
@@ -386,7 +386,7 @@ Creates a URL.
**Example**
**Example**
```
```
js
var
mm
=
'
http://username:password@host:8080
'
;
var
mm
=
'
http://username:password@host:8080
'
;
var
a
=
new
URL
(
"
/
"
,
mm
);
// Output 'http://username:password@host:8080/';
var
a
=
new
URL
(
"
/
"
,
mm
);
// Output 'http://username:password@host:8080/';
var
b
=
new
URL
(
mm
);
// Output 'http://username:password@host:8080/';
var
b
=
new
URL
(
mm
);
// Output 'http://username:password@host:8080/';
...
@@ -416,7 +416,7 @@ Converts the parsed URL into a string.
...
@@ -416,7 +416,7 @@ Converts the parsed URL into a string.
**Example**
**Example**
```
```
js
const
url
=
new
URL
(
'
http://username:password@host:8080/directory/file?query=pppppp#qwer=da
'
);
const
url
=
new
URL
(
'
http://username:password@host:8080/directory/file?query=pppppp#qwer=da
'
);
url
.
toString
()
url
.
toString
()
```
```
...
@@ -436,7 +436,7 @@ Converts the parsed URL into a JSON string.
...
@@ -436,7 +436,7 @@ Converts the parsed URL into a JSON string.
| string | Website address in a serialized string.|
| string | Website address in a serialized string.|
**Example**
**Example**
```
```
js
const
url
=
new
URL
(
'
http://username:password@host:8080/directory/file?query=pppppp#qwer=da
'
);
const
url
=
new
URL
(
'
http://username:password@host:8080/directory/file?query=pppppp#qwer=da
'
);
url
.
toJSON
()
url
.
toJSON
()
```
```
en/application-dev/reference/apis/js-apis-util.md
浏览文件 @
73180797
此差异已折叠。
点击以展开。
en/application-dev/reference/apis/js-apis-xml.md
浏览文件 @
73180797
...
@@ -32,7 +32,7 @@ A constructor used to create an **XmlSerializer** instance.
...
@@ -32,7 +32,7 @@ A constructor used to create an **XmlSerializer** instance.
**Example**
**Example**
```
```
js
var
arrayBuffer
=
new
ArrayBuffer
(
1024
);
var
arrayBuffer
=
new
ArrayBuffer
(
1024
);
var
bufView
=
new
DataView
(
arrayBuffer
);
var
bufView
=
new
DataView
(
arrayBuffer
);
var
thatSer
=
new
xml
.
XmlSerializer
(
bufView
);
var
thatSer
=
new
xml
.
XmlSerializer
(
bufView
);
...
@@ -54,7 +54,7 @@ Sets an attribute.
...
@@ -54,7 +54,7 @@ Sets an attribute.
**Example**
**Example**
```
```
js
var
thatSer
=
new
xml
.
XmlSerializer
(
bufView
);
var
thatSer
=
new
xml
.
XmlSerializer
(
bufView
);
thatSer
.
setAttributes
(
"
importance
"
,
"
high
"
);
thatSer
.
setAttributes
(
"
importance
"
,
"
high
"
);
```
```
...
@@ -74,8 +74,8 @@ Adds an empty element.
...
@@ -74,8 +74,8 @@ Adds an empty element.
**Example**
**Example**
```
```
js
var thatSer = new xml.XmlSerializer(bufView);
var
thatSer
=
new
xml
.
XmlSerializer
(
bufView
);
thatSer
.
addEmptyElement
(
"
b
"
);
// => <b/>
thatSer
.
addEmptyElement
(
"
b
"
);
// => <b/>
```
```
...
@@ -88,7 +88,7 @@ Sets a declaration.
...
@@ -88,7 +88,7 @@ Sets a declaration.
**Example**
**Example**
```
```
js
var
thatSer
=
new
xml
.
XmlSerializer
(
bufView
);
var
thatSer
=
new
xml
.
XmlSerializer
(
bufView
);
thatSer
.
setDeclaration
()
// => <?xml version="1.0" encoding="utf-8"?>;
thatSer
.
setDeclaration
()
// => <?xml version="1.0" encoding="utf-8"?>;
```
```
...
@@ -108,7 +108,7 @@ Writes the start tag based on the given element name.
...
@@ -108,7 +108,7 @@ Writes the start tag based on the given element name.
**Example**
**Example**
```
```
js
var
arrayBuffer
=
new
ArrayBuffer
(
1024
);
var
arrayBuffer
=
new
ArrayBuffer
(
1024
);
var
thatSer
=
new
xml
.
XmlSerializer
(
arrayBuffer
);
var
thatSer
=
new
xml
.
XmlSerializer
(
arrayBuffer
);
thatSer
.
startElement
(
"
notel
"
);
thatSer
.
startElement
(
"
notel
"
);
...
@@ -124,7 +124,7 @@ Writes the end tag of the element.
...
@@ -124,7 +124,7 @@ Writes the end tag of the element.
**Example**
**Example**
```
```
js
var
thatSer
=
new
xml
.
XmlSerializer
(
bufView
);
var
thatSer
=
new
xml
.
XmlSerializer
(
bufView
);
thatSer
.
setNamespace
(
"
h
"
,
"
http://www.w3.org/TR/html4/
"
);
thatSer
.
setNamespace
(
"
h
"
,
"
http://www.w3.org/TR/html4/
"
);
thatSer
.
startElement
(
"
table
"
);
thatSer
.
startElement
(
"
table
"
);
...
@@ -149,7 +149,7 @@ Sets the namespace for an element tag.
...
@@ -149,7 +149,7 @@ Sets the namespace for an element tag.
**Example**
**Example**
```
```
js
var
arrayBuffer
=
new
ArrayBuffer
(
1024
);
var
arrayBuffer
=
new
ArrayBuffer
(
1024
);
var
thatSer
=
new
xml
.
XmlSerializer
(
arrayBuffer
);
var
thatSer
=
new
xml
.
XmlSerializer
(
arrayBuffer
);
thatSer
.
setDeclaration
();
thatSer
.
setDeclaration
();
...
@@ -172,7 +172,7 @@ Sets the comment.
...
@@ -172,7 +172,7 @@ Sets the comment.
**Example**
**Example**
```
```
js
var
arrayBuffer
=
new
ArrayBuffer
(
1024
);
var
arrayBuffer
=
new
ArrayBuffer
(
1024
);
var
thatSer
=
new
xml
.
XmlSerializer
(
arrayBuffer
);
var
thatSer
=
new
xml
.
XmlSerializer
(
arrayBuffer
);
thatSer
.
startElement
(
"
note
"
);
thatSer
.
startElement
(
"
note
"
);
...
@@ -195,7 +195,7 @@ Sets CDATA attributes.
...
@@ -195,7 +195,7 @@ Sets CDATA attributes.
**Example**
**Example**
```
```
js
var
arrayBuffer
=
new
ArrayBuffer
(
1028
);
var
arrayBuffer
=
new
ArrayBuffer
(
1028
);
var
thatSer
=
new
xml
.
XmlSerializer
(
arrayBuffer
);
var
thatSer
=
new
xml
.
XmlSerializer
(
arrayBuffer
);
thatSer
.
setCDATA
(
'
root SYSTEM
'
)
// => '<![CDATA[root SYSTEM]]>';
thatSer
.
setCDATA
(
'
root SYSTEM
'
)
// => '<![CDATA[root SYSTEM]]>';
...
@@ -216,7 +216,7 @@ Sets **Text**.
...
@@ -216,7 +216,7 @@ Sets **Text**.
**Example**
**Example**
```
```
js
var
arrayBuffer
=
new
ArrayBuffer
(
1024
);
var
arrayBuffer
=
new
ArrayBuffer
(
1024
);
var
thatSer
=
new
xml
.
XmlSerializer
(
arrayBuffer
);
var
thatSer
=
new
xml
.
XmlSerializer
(
arrayBuffer
);
thatSer
.
startElement
(
"
note
"
);
thatSer
.
startElement
(
"
note
"
);
...
@@ -240,7 +240,7 @@ Sets **DocType**.
...
@@ -240,7 +240,7 @@ Sets **DocType**.
**Example**
**Example**
```
```
js
var
arrayBuffer
=
new
ArrayBuffer
(
1024
);
var
arrayBuffer
=
new
ArrayBuffer
(
1024
);
var
thatSer
=
new
xml
.
XmlSerializer
(
arrayBuffer
);
var
thatSer
=
new
xml
.
XmlSerializer
(
arrayBuffer
);
thatSer
.
setDocType
(
'
root SYSTEM
'
);
// => '<!DOCTYPE root SYSTEM>';
thatSer
.
setDocType
(
'
root SYSTEM
'
);
// => '<!DOCTYPE root SYSTEM>';
...
@@ -265,7 +265,7 @@ Creates and returns an **XmlPullParser** object. The **XmlPullParser** object pa
...
@@ -265,7 +265,7 @@ Creates and returns an **XmlPullParser** object. The **XmlPullParser** object pa
**Example**
**Example**
```
```
js
var
strXml
=
var
strXml
=
'
<?xml version="1.0" encoding="utf-8"?>
'
+
'
<?xml version="1.0" encoding="utf-8"?>
'
+
'
<note importance="high" logged="true">
'
+
'
<note importance="high" logged="true">
'
+
...
@@ -297,7 +297,7 @@ Parses XML information.
...
@@ -297,7 +297,7 @@ Parses XML information.
**Example**
**Example**
```
```
js
var
strXml
=
var
strXml
=
'
<?xml version="1.0" encoding="utf-8"?>
'
+
'
<?xml version="1.0" encoding="utf-8"?>
'
+
'
<note importance="high" logged="true">
'
+
'
<note importance="high" logged="true">
'
+
...
...
zh-cn/application-dev/reference/apis/js-apis-convertxml.md
浏览文件 @
73180797
...
@@ -39,7 +39,7 @@ convert(xml: string, options?: ConvertOptions) : Object
...
@@ -39,7 +39,7 @@ convert(xml: string, options?: ConvertOptions) : Object
-
示例:
-
示例:
```
```
js
let
xml
=
let
xml
=
'
<?xml version="1.0" encoding="utf-8"?>
'
+
'
<?xml version="1.0" encoding="utf-8"?>
'
+
'
<note importance="high" logged="true">
'
+
'
<note importance="high" logged="true">
'
+
...
...
zh-cn/application-dev/reference/apis/js-apis-process.md
浏览文件 @
73180797
...
@@ -60,7 +60,7 @@ wait(): Promise<number>
...
@@ -60,7 +60,7 @@ wait(): Promise<number>
**示例:**
**示例:**
```
```
js
var
child
=
process
.
runCmd
(
'
ls
'
);
var
child
=
process
.
runCmd
(
'
ls
'
);
var
result
=
child
.
wait
();
var
result
=
child
.
wait
();
result
.
then
(
val
=>
{
result
.
then
(
val
=>
{
...
@@ -85,7 +85,7 @@ getOutput(): Promise<Uint8Array>
...
@@ -85,7 +85,7 @@ getOutput(): Promise<Uint8Array>
**示例:**
**示例:**
```
```
js
var
child
=
process
.
runCmd
(
'
ls
'
);
var
child
=
process
.
runCmd
(
'
ls
'
);
var
result
=
child
.
wait
();
var
result
=
child
.
wait
();
child
.
getOutput
.
then
(
val
=>
{
child
.
getOutput
.
then
(
val
=>
{
...
@@ -110,7 +110,7 @@ getErrorOutput(): Promise<Uint8Array>
...
@@ -110,7 +110,7 @@ getErrorOutput(): Promise<Uint8Array>
**示例:**
**示例:**
```
```
js
var
child
=
process
.
runCmd
(
'
madir test.text
'
);
var
child
=
process
.
runCmd
(
'
madir test.text
'
);
var
result
=
child
.
wait
();
var
result
=
child
.
wait
();
child
.
getErrorOutput
.
then
(
val
=>
{
child
.
getErrorOutput
.
then
(
val
=>
{
...
@@ -129,7 +129,7 @@ close(): void
...
@@ -129,7 +129,7 @@ close(): void
**示例:**
**示例:**
```
```
js
var
child
=
process
.
runCmd
(
'
sleep 5; ls
'
);
var
child
=
process
.
runCmd
(
'
sleep 5; ls
'
);
child
.
close
();
child
.
close
();
```
```
...
@@ -151,7 +151,7 @@ kill(signal: number | string): void
...
@@ -151,7 +151,7 @@ kill(signal: number | string): void
**示例:**
**示例:**
```
```
js
var
child
=
process
.
runCmd
(
'
sleep 5; ls
'
);
var
child
=
process
.
runCmd
(
'
sleep 5; ls
'
);
child
.
kill
(
9
);
child
.
kill
(
9
);
```
```
...
@@ -173,7 +173,7 @@ isIsolatedProcess(): boolean
...
@@ -173,7 +173,7 @@ isIsolatedProcess(): boolean
**示例:**
**示例:**
```
```
js
var
result
=
process
.
isIsolatedProcess
();
var
result
=
process
.
isIsolatedProcess
();
```
```
...
@@ -200,7 +200,7 @@ isAppUid(v: number): boolean
...
@@ -200,7 +200,7 @@ isAppUid(v: number): boolean
**示例:**
**示例:**
```
```
js
var
result
=
process
.
isAppUid
(
688
);
var
result
=
process
.
isAppUid
(
688
);
```
```
...
@@ -221,7 +221,7 @@ is64Bit(): boolean
...
@@ -221,7 +221,7 @@ is64Bit(): boolean
**示例:**
**示例:**
```
```
js
var
ressult
=
process
.
is64Bit
();
var
ressult
=
process
.
is64Bit
();
```
```
...
@@ -248,7 +248,7 @@ getUidForName(v: string): number
...
@@ -248,7 +248,7 @@ getUidForName(v: string): number
**示例:**
**示例:**
```
```
js
var
pres
=
process
.
getUidForName
(
"
tool
"
)
var
pres
=
process
.
getUidForName
(
"
tool
"
)
```
```
...
@@ -275,7 +275,7 @@ getThreadPriority(v: number): number
...
@@ -275,7 +275,7 @@ getThreadPriority(v: number): number
**示例:**
**示例:**
```
```
js
var
tid
=
process
.
getTid
();
var
tid
=
process
.
getTid
();
var
pres
=
process
.
getThreadPriority
(
tid
);
var
pres
=
process
.
getThreadPriority
(
tid
);
```
```
...
@@ -297,7 +297,7 @@ getStartRealtime(): number
...
@@ -297,7 +297,7 @@ getStartRealtime(): number
**示例:**
**示例:**
```
```
js
var
realtime
=
process
.
getStartRealtime
();
var
realtime
=
process
.
getStartRealtime
();
```
```
...
@@ -317,7 +317,7 @@ getPastCpuTime(): number
...
@@ -317,7 +317,7 @@ getPastCpuTime(): number
**示例:**
**示例:**
```
```
js
var
result
=
process
.
getPastCpuTime
()
;
var
result
=
process
.
getPastCpuTime
()
;
```
```
...
@@ -344,7 +344,7 @@ getSystemConfig(name: number): number
...
@@ -344,7 +344,7 @@ getSystemConfig(name: number): number
**示例:**
**示例:**
```
```
js
var
_SC_ARG_MAX
=
0
var
_SC_ARG_MAX
=
0
var
pres
=
process
.
getSystemConfig
(
_SC_ARG_MAX
)
var
pres
=
process
.
getSystemConfig
(
_SC_ARG_MAX
)
```
```
...
@@ -372,7 +372,7 @@ getEnvironmentVar(name: string): string
...
@@ -372,7 +372,7 @@ getEnvironmentVar(name: string): string
**示例:**
**示例:**
```
```
js
var
pres
=
process
.
getEnvironmentVar
(
"
PATH
"
)
var
pres
=
process
.
getEnvironmentVar
(
"
PATH
"
)
```
```
...
@@ -408,7 +408,7 @@ runCmd(command: string, options?: { timeout : number, killSignal : number | stri
...
@@ -408,7 +408,7 @@ runCmd(command: string, options?: { timeout : number, killSignal : number | stri
**示例:**
**示例:**
```
```
js
var
child
=
process
.
runCmd
(
'
ls
'
,
{
maxBuffer
:
2
});
var
child
=
process
.
runCmd
(
'
ls
'
,
{
maxBuffer
:
2
});
var
result
=
child
.
wait
();
var
result
=
child
.
wait
();
child
.
getOutput
.
then
(
val
=>
{
child
.
getOutput
.
then
(
val
=>
{
...
@@ -427,7 +427,7 @@ abort(): void
...
@@ -427,7 +427,7 @@ abort(): void
**示例:**
**示例:**
```
```
js
process
.
abort
();
process
.
abort
();
```
```
...
@@ -455,7 +455,7 @@ on(type: string, listener: EventListener): void
...
@@ -455,7 +455,7 @@ on(type: string, listener: EventListener): void
**示例:**
**示例:**
```
```
js
process
.
on
(
"
data
"
,
(
e
)
=>
{
process
.
on
(
"
data
"
,
(
e
)
=>
{
console
.
log
(
"
data callback
"
);
console
.
log
(
"
data callback
"
);
})
})
...
@@ -484,7 +484,7 @@ off(type: string): boolean
...
@@ -484,7 +484,7 @@ off(type: string): boolean
**示例:**
**示例:**
```
```
js
process
.
on
(
"
data
"
,
(
e
)
=>
{
process
.
on
(
"
data
"
,
(
e
)
=>
{
console
.
log
(
"
data callback
"
);
console
.
log
(
"
data callback
"
);
})
})
...
@@ -510,7 +510,7 @@ exit(code: number): void
...
@@ -510,7 +510,7 @@ exit(code: number): void
**示例:**
**示例:**
```
```
js
process
.
exit
(
0
);
process
.
exit
(
0
);
```
```
...
@@ -525,7 +525,7 @@ cwd(): string
...
@@ -525,7 +525,7 @@ cwd(): string
**示例:**
**示例:**
```
```
js
var
path
=
process
.
cwd
();
var
path
=
process
.
cwd
();
```
```
...
@@ -546,7 +546,7 @@ chdir(dir: string): void
...
@@ -546,7 +546,7 @@ chdir(dir: string): void
**示例:**
**示例:**
```
```
js
process
.
chdir
(
'
/system
'
);
process
.
chdir
(
'
/system
'
);
```
```
...
@@ -567,7 +567,7 @@ uptime(): number
...
@@ -567,7 +567,7 @@ uptime(): number
**示例:**
**示例:**
```
```
js
var
time
=
process
.
uptime
();
var
time
=
process
.
uptime
();
```
```
...
@@ -594,7 +594,8 @@ kill(signal: number, pid: number): boolean
...
@@ -594,7 +594,8 @@ kill(signal: number, pid: number): boolean
| boolean | 信号是否发送成功。 |
| boolean | 信号是否发送成功。 |
**示例:**
**示例:**
```
```
js
var
pres
=
process
.
pid
var
pres
=
process
.
pid
var
result
=
that
.
kill
(
pres
,
28
)
var
result
=
that
.
kill
(
pres
,
28
)
```
```
zh-cn/application-dev/reference/apis/js-apis-uri.md
浏览文件 @
73180797
...
@@ -46,11 +46,11 @@ constructor是URI的构造函数。
...
@@ -46,11 +46,11 @@ constructor是URI的构造函数。
**示例:**
**示例:**
```
```
js
var
mm
=
'
http://username:password@host:8080/directory/file?foo=1&bar=2#fragment
'
;
var
mm
=
'
http://username:password@host:8080/directory/file?foo=1&bar=2#fragment
'
;
new
uri
.
URI
(
mm
);
// Output 'http://username:password@host:8080/directory/file?foo=1&bar=2#fragment';
new
uri
.
URI
(
mm
);
// Output 'http://username:password@host:8080/directory/file?foo=1&bar=2#fragment';
```
```
```
```
js
new
uri
.
URI
(
'
http://username:password@host:8080
'
);
// Output 'http://username:password@host:8080';
new
uri
.
URI
(
'
http://username:password@host:8080
'
);
// Output 'http://username:password@host:8080';
```
```
...
@@ -69,7 +69,7 @@ toString(): string
...
@@ -69,7 +69,7 @@ toString(): string
**示例:**
**示例:**
```
```
js
const
url
=
new
uri
.
URL
(
'
http://username:password@host:8080/directory/file?query=pppppp#qwer=da
'
);
const
url
=
new
uri
.
URL
(
'
http://username:password@host:8080/directory/file?query=pppppp#qwer=da
'
);
url
.
toString
()
url
.
toString
()
```
```
...
@@ -95,7 +95,7 @@ equals(other: URI): boolean
...
@@ -95,7 +95,7 @@ equals(other: URI): boolean
**示例:**
**示例:**
```
```
js
const
uriInstance
=
new
uri
.
URI
(
'
http://username:password@host:8080/directory/file?query=pppppp#qwer=da
'
);
const
uriInstance
=
new
uri
.
URI
(
'
http://username:password@host:8080/directory/file?query=pppppp#qwer=da
'
);
const
uriInstance1
=
new
uri
.
URI
(
'
http://username:password@host:8080/directory/file?query=pppppp#qwer=da#fragment
'
);
const
uriInstance1
=
new
uri
.
URI
(
'
http://username:password@host:8080/directory/file?query=pppppp#qwer=da#fragment
'
);
uriInstance
.
equals
(
uriInstance1
);
uriInstance
.
equals
(
uriInstance1
);
...
@@ -115,7 +115,7 @@ checkIsAbsolute(): boolean
...
@@ -115,7 +115,7 @@ checkIsAbsolute(): boolean
**示例:**
**示例:**
```
```
js
const
uriInstance
=
new
uri
.
URI
(
'
http://username:password@www.qwer.com:8080?query=pppppp
'
);
const
uriInstance
=
new
uri
.
URI
(
'
http://username:password@www.qwer.com:8080?query=pppppp
'
);
uriInstance
.
checkIsAbsolute
();
uriInstance
.
checkIsAbsolute
();
```
```
...
@@ -134,7 +134,7 @@ normalize(): URI
...
@@ -134,7 +134,7 @@ normalize(): URI
| URI | 返回一个path被规范化后的URI对象。 |
| URI | 返回一个path被规范化后的URI对象。 |
**示例:**
**示例:**
```
```
js
const
uriInstance
=
new
uri
.
URI
(
'
http://username:password@www.qwer.com:8080/path/path1/../path2/./path3?query=pppppp
'
);
const
uriInstance
=
new
uri
.
URI
(
'
http://username:password@www.qwer.com:8080/path/path1/../path2/./path3?query=pppppp
'
);
let
uriInstance1
=
uriInstance
.
normalize
();
let
uriInstance1
=
uriInstance
.
normalize
();
uriInstance1
.
path
;
uriInstance1
.
path
;
...
...
zh-cn/application-dev/reference/apis/js-apis-url.md
浏览文件 @
73180797
...
@@ -31,7 +31,7 @@ URLSearchParams的构造函数。
...
@@ -31,7 +31,7 @@ URLSearchParams的构造函数。
**示例:**
**示例:**
```
```
js
var
objectParams
=
new
URLSearchParams
([
[
'
user1
'
,
'
abc1
'
],
[
'
query2
'
,
'
first2
'
],
[
'
query3
'
,
'
second3
'
]
]);
var
objectParams
=
new
URLSearchParams
([
[
'
user1
'
,
'
abc1
'
],
[
'
query2
'
,
'
first2
'
],
[
'
query3
'
,
'
second3
'
]
]);
var
objectParams1
=
new
URLSearchParams
({
"
fod
"
:
1
,
"
bard
"
:
2
});
var
objectParams1
=
new
URLSearchParams
({
"
fod
"
:
1
,
"
bard
"
:
2
});
var
objectParams2
=
new
URLSearchParams
(
'
?fod=1&bard=2
'
);
var
objectParams2
=
new
URLSearchParams
(
'
?fod=1&bard=2
'
);
...
@@ -55,7 +55,7 @@ append(name: string, value: string): void
...
@@ -55,7 +55,7 @@ append(name: string, value: string): void
**示例:**
**示例:**
```
```
js
let
urlObject
=
new
URL
(
'
https://developer.exampleUrl/?fod=1&bard=2
'
);
let
urlObject
=
new
URL
(
'
https://developer.exampleUrl/?fod=1&bard=2
'
);
let
paramsObject
=
new
URLSearchParams
(
urlObject
.
search
.
slice
(
1
));
let
paramsObject
=
new
URLSearchParams
(
urlObject
.
search
.
slice
(
1
));
paramsObject
.
append
(
'
fod
'
,
3
);
paramsObject
.
append
(
'
fod
'
,
3
);
...
@@ -76,7 +76,7 @@ delete(name: string): void
...
@@ -76,7 +76,7 @@ delete(name: string): void
**示例:**
**示例:**
```
```
js
let
urlObject
=
new
URL
(
'
https://developer.exampleUrl/?fod=1&bard=2
'
);
let
urlObject
=
new
URL
(
'
https://developer.exampleUrl/?fod=1&bard=2
'
);
let
paramsobject
=
new
URLSearchParams
(
urlObject
.
search
.
slice
(
1
));
let
paramsobject
=
new
URLSearchParams
(
urlObject
.
search
.
slice
(
1
));
paramsobject
.
delete
(
'
fod
'
);
paramsobject
.
delete
(
'
fod
'
);
...
@@ -103,7 +103,7 @@ getAll(name: string): string[]
...
@@ -103,7 +103,7 @@ getAll(name: string): string[]
**示例:**
**示例:**
```
```
js
let
urlObject
=
new
URL
(
'
https://developer.exampleUrl/?fod=1&bard=2
'
);
let
urlObject
=
new
URL
(
'
https://developer.exampleUrl/?fod=1&bard=2
'
);
let
paramsObject
=
new
URLSearchParams
(
urlObject
.
search
.
slice
(
1
));
let
paramsObject
=
new
URLSearchParams
(
urlObject
.
search
.
slice
(
1
));
paramsObject
.
append
(
'
fod
'
,
3
);
// Add a second value for the fod parameter.
paramsObject
.
append
(
'
fod
'
,
3
);
// Add a second value for the fod parameter.
...
@@ -125,7 +125,7 @@ entries(): IterableIterator<[string, string]>
...
@@ -125,7 +125,7 @@ entries(): IterableIterator<[string, string]>
**示例:**
**示例:**
```
```
js
var
searchParamsObject
=
new
URLSearchParams
(
"
keyName1=valueName1&keyName2=valueName2
"
);
var
searchParamsObject
=
new
URLSearchParams
(
"
keyName1=valueName1&keyName2=valueName2
"
);
for
(
var
pair
of
searchParamsObject
.
entries
())
{
// Show keyName/valueName pairs
for
(
var
pair
of
searchParamsObject
.
entries
())
{
// Show keyName/valueName pairs
console
.
log
(
pair
[
0
]
+
'
,
'
+
pair
[
1
]);
console
.
log
(
pair
[
0
]
+
'
,
'
+
pair
[
1
]);
...
@@ -156,7 +156,7 @@ forEach(callbackfn: (value: string, key: string, searchParams: this) => void, th
...
@@ -156,7 +156,7 @@ forEach(callbackfn: (value: string, key: string, searchParams: this) => void, th
**示例:**
**示例:**
```
```
js
const
myURLObject
=
new
URL
(
'
https://developer.exampleUrl/?fod=1&bard=2
'
);
const
myURLObject
=
new
URL
(
'
https://developer.exampleUrl/?fod=1&bard=2
'
);
myURLObject
.
searchParams
.
forEach
((
value
,
name
,
searchParams
)
=>
{
myURLObject
.
searchParams
.
forEach
((
value
,
name
,
searchParams
)
=>
{
console
.
log
(
name
,
value
,
myURLObject
.
searchParams
===
searchParams
);
console
.
log
(
name
,
value
,
myURLObject
.
searchParams
===
searchParams
);
...
@@ -185,7 +185,7 @@ get(name: string): string | null
...
@@ -185,7 +185,7 @@ get(name: string): string | null
**示例:**
**示例:**
```
```
js
var
paramsOject
=
new
URLSearchParams
(
document
.
location
.
search
.
substring
(
1
));
var
paramsOject
=
new
URLSearchParams
(
document
.
location
.
search
.
substring
(
1
));
var
name
=
paramsOject
.
get
(
"
name
"
);
// is the string "Jonathan"
var
name
=
paramsOject
.
get
(
"
name
"
);
// is the string "Jonathan"
var
age
=
parseInt
(
paramsOject
.
get
(
"
age
"
),
10
);
// is the number 18
var
age
=
parseInt
(
paramsOject
.
get
(
"
age
"
),
10
);
// is the number 18
...
@@ -213,7 +213,7 @@ has(name: string): boolean
...
@@ -213,7 +213,7 @@ has(name: string): boolean
**示例:**
**示例:**
```
```
js
let
urlObject
=
new
URL
(
'
https://developer.exampleUrl/?fod=1&bard=2
'
);
let
urlObject
=
new
URL
(
'
https://developer.exampleUrl/?fod=1&bard=2
'
);
let
paramsObject
=
new
URLSearchParams
(
urlObject
.
search
.
slice
(
1
));
let
paramsObject
=
new
URLSearchParams
(
urlObject
.
search
.
slice
(
1
));
paramsObject
.
has
(
'
bard
'
)
===
true
;
paramsObject
.
has
(
'
bard
'
)
===
true
;
...
@@ -235,7 +235,7 @@ set(name: string, value: string): void
...
@@ -235,7 +235,7 @@ set(name: string, value: string): void
**示例:**
**示例:**
```
```
js
let
urlObject
=
new
URL
(
'
https://developer.exampleUrl/?fod=1&bard=2
'
);
let
urlObject
=
new
URL
(
'
https://developer.exampleUrl/?fod=1&bard=2
'
);
let
paramsObject
=
new
URLSearchParams
(
urlObject
.
search
.
slice
(
1
));
let
paramsObject
=
new
URLSearchParams
(
urlObject
.
search
.
slice
(
1
));
paramsObject
.
set
(
'
baz
'
,
3
);
// Add a third parameter.
paramsObject
.
set
(
'
baz
'
,
3
);
// Add a third parameter.
...
@@ -251,7 +251,7 @@ sort(): void
...
@@ -251,7 +251,7 @@ sort(): void
**示例:**
**示例:**
```
```
js
var
searchParamsObject
=
new
URLSearchParams
(
"
c=3&a=9&b=4&d=2
"
);
// Create a test URLSearchParams object
var
searchParamsObject
=
new
URLSearchParams
(
"
c=3&a=9&b=4&d=2
"
);
// Create a test URLSearchParams object
searchParamsObject
.
sort
();
// Sort the key/value pairs
searchParamsObject
.
sort
();
// Sort the key/value pairs
console
.
log
(
searchParamsObject
.
toString
());
// Display the sorted query string // Output a=9&b=2&c=3&d=4
console
.
log
(
searchParamsObject
.
toString
());
// Display the sorted query string // Output a=9&b=2&c=3&d=4
...
@@ -273,7 +273,7 @@ keys(): IterableIterator<string>
...
@@ -273,7 +273,7 @@ keys(): IterableIterator<string>
**示例:**
**示例:**
```
```
js
var
searchParamsObject
=
new
URLSearchParams
(
"
key1=value1&key2=value2
"
);
// Create a URLSearchParamsObject object for testing
var
searchParamsObject
=
new
URLSearchParams
(
"
key1=value1&key2=value2
"
);
// Create a URLSearchParamsObject object for testing
for
(
var
key
of
searchParamsObject
.
keys
())
{
// Output key-value pairs
for
(
var
key
of
searchParamsObject
.
keys
())
{
// Output key-value pairs
console
.
log
(
key
);
console
.
log
(
key
);
...
@@ -295,7 +295,7 @@ values(): IterableIterator<string>
...
@@ -295,7 +295,7 @@ values(): IterableIterator<string>
**示例:**
**示例:**
```
```
js
var
searchParams
=
new
URLSearchParams
(
"
key1=value1&key2=value2
"
);
// Create a URLSearchParamsObject object for testing
var
searchParams
=
new
URLSearchParams
(
"
key1=value1&key2=value2
"
);
// Create a URLSearchParamsObject object for testing
for
(
var
value
of
searchParams
.
values
())
{
for
(
var
value
of
searchParams
.
values
())
{
console
.
log
(
value
);
console
.
log
(
value
);
...
@@ -318,7 +318,7 @@ for (var value of searchParams.values()) {
...
@@ -318,7 +318,7 @@ for (var value of searchParams.values()) {
**示例:**
**示例:**
```
```
js
const
paramsObject
=
new
URLSearchParams
(
'
fod=bay&edg=bap
'
);
const
paramsObject
=
new
URLSearchParams
(
'
fod=bay&edg=bap
'
);
for
(
const
[
name
,
value
]
of
paramsObject
)
{
for
(
const
[
name
,
value
]
of
paramsObject
)
{
console
.
log
(
name
,
value
);
console
.
log
(
name
,
value
);
...
@@ -341,7 +341,7 @@ toString(): string
...
@@ -341,7 +341,7 @@ toString(): string
**示例:**
**示例:**
```
```
js
let
url
=
new
URL
(
'
https://developer.exampleUrl/?fod=1&bard=2
'
);
let
url
=
new
URL
(
'
https://developer.exampleUrl/?fod=1&bard=2
'
);
let
params
=
new
URLSearchParams
(
url
.
search
.
slice
(
1
));
let
params
=
new
URLSearchParams
(
url
.
search
.
slice
(
1
));
params
.
append
(
'
fod
'
,
3
);
params
.
append
(
'
fod
'
,
3
);
...
@@ -386,7 +386,7 @@ URL的构造函数。
...
@@ -386,7 +386,7 @@ URL的构造函数。
**示例:**
**示例:**
```
```
js
var
mm
=
'
http://username:password@host:8080
'
;
var
mm
=
'
http://username:password@host:8080
'
;
var
a
=
new
URL
(
"
/
"
,
mm
);
// Output 'http://username:password@host:8080/';
var
a
=
new
URL
(
"
/
"
,
mm
);
// Output 'http://username:password@host:8080/';
var
b
=
new
URL
(
mm
);
// Output 'http://username:password@host:8080/';
var
b
=
new
URL
(
mm
);
// Output 'http://username:password@host:8080/';
...
@@ -416,7 +416,7 @@ toString(): string
...
@@ -416,7 +416,7 @@ toString(): string
**示例:**
**示例:**
```
```
js
const
url
=
new
URL
(
'
http://username:password@host:8080/directory/file?query=pppppp#qwer=da
'
);
const
url
=
new
URL
(
'
http://username:password@host:8080/directory/file?query=pppppp#qwer=da
'
);
url
.
toString
()
url
.
toString
()
```
```
...
@@ -436,7 +436,7 @@ toJSON(): string
...
@@ -436,7 +436,7 @@ toJSON(): string
| string | 用于返回网址的字符串序列化。 |
| string | 用于返回网址的字符串序列化。 |
**示例:**
**示例:**
```
```
js
const
url
=
new
URL
(
'
http://username:password@host:8080/directory/file?query=pppppp#qwer=da
'
);
const
url
=
new
URL
(
'
http://username:password@host:8080/directory/file?query=pppppp#qwer=da
'
);
url
.
toJSON
()
url
.
toJSON
()
```
```
zh-cn/application-dev/reference/apis/js-apis-util.md
浏览文件 @
73180797
此差异已折叠。
点击以展开。
zh-cn/application-dev/reference/apis/js-apis-xml.md
浏览文件 @
73180797
...
@@ -32,7 +32,7 @@ XmlSerializer的构造函数。
...
@@ -32,7 +32,7 @@ XmlSerializer的构造函数。
**示例:**
**示例:**
```
```
js
var
arrayBuffer
=
new
ArrayBuffer
(
1024
);
var
arrayBuffer
=
new
ArrayBuffer
(
1024
);
var
bufView
=
new
DataView
(
arrayBuffer
);
var
bufView
=
new
DataView
(
arrayBuffer
);
var
thatSer
=
new
xml
.
XmlSerializer
(
bufView
);
var
thatSer
=
new
xml
.
XmlSerializer
(
bufView
);
...
@@ -54,7 +54,7 @@ setAttributes(name: string, value: string): void
...
@@ -54,7 +54,7 @@ setAttributes(name: string, value: string): void
**示例:**
**示例:**
```
```
js
var
thatSer
=
new
xml
.
XmlSerializer
(
bufView
);
var
thatSer
=
new
xml
.
XmlSerializer
(
bufView
);
thatSer
.
setAttributes
(
"
importance
"
,
"
high
"
);
thatSer
.
setAttributes
(
"
importance
"
,
"
high
"
);
```
```
...
@@ -74,8 +74,8 @@ addEmptyElement(name: string): void
...
@@ -74,8 +74,8 @@ addEmptyElement(name: string): void
**示例:**
**示例:**
```
```
js
var thatSer = new xml.XmlSerializer(bufView);
var
thatSer
=
new
xml
.
XmlSerializer
(
bufView
);
thatSer
.
addEmptyElement
(
"
b
"
);
// => <b/>
thatSer
.
addEmptyElement
(
"
b
"
);
// => <b/>
```
```
...
@@ -88,7 +88,7 @@ setDeclaration(): void
...
@@ -88,7 +88,7 @@ setDeclaration(): void
**示例:**
**示例:**
```
```
js
var
thatSer
=
new
xml
.
XmlSerializer
(
bufView
);
var
thatSer
=
new
xml
.
XmlSerializer
(
bufView
);
thatSer
.
setDeclaration
()
// => <?xml version="1.0" encoding="utf-8"?>;
thatSer
.
setDeclaration
()
// => <?xml version="1.0" encoding="utf-8"?>;
```
```
...
@@ -108,7 +108,7 @@ startElement(name: string): void
...
@@ -108,7 +108,7 @@ startElement(name: string): void
**示例:**
**示例:**
```
```
js
var
arrayBuffer
=
new
ArrayBuffer
(
1024
);
var
arrayBuffer
=
new
ArrayBuffer
(
1024
);
var
thatSer
=
new
xml
.
XmlSerializer
(
arrayBuffer
);
var
thatSer
=
new
xml
.
XmlSerializer
(
arrayBuffer
);
thatSer
.
startElement
(
"
notel
"
);
thatSer
.
startElement
(
"
notel
"
);
...
@@ -124,7 +124,7 @@ endElement(): void
...
@@ -124,7 +124,7 @@ endElement(): void
**示例:**
**示例:**
```
```
js
var
thatSer
=
new
xml
.
XmlSerializer
(
bufView
);
var
thatSer
=
new
xml
.
XmlSerializer
(
bufView
);
thatSer
.
setNamespace
(
"
h
"
,
"
http://www.w3.org/TR/html4/
"
);
thatSer
.
setNamespace
(
"
h
"
,
"
http://www.w3.org/TR/html4/
"
);
thatSer
.
startElement
(
"
table
"
);
thatSer
.
startElement
(
"
table
"
);
...
@@ -149,7 +149,7 @@ setNamespace(prefix: string, namespace: string): void
...
@@ -149,7 +149,7 @@ setNamespace(prefix: string, namespace: string): void
**示例:**
**示例:**
```
```
js
var
arrayBuffer
=
new
ArrayBuffer
(
1024
);
var
arrayBuffer
=
new
ArrayBuffer
(
1024
);
var
thatSer
=
new
xml
.
XmlSerializer
(
arrayBuffer
);
var
thatSer
=
new
xml
.
XmlSerializer
(
arrayBuffer
);
thatSer
.
setDeclaration
();
thatSer
.
setDeclaration
();
...
@@ -172,7 +172,7 @@ setComment(text: string): void
...
@@ -172,7 +172,7 @@ setComment(text: string): void
**示例:**
**示例:**
```
```
js
var
arrayBuffer
=
new
ArrayBuffer
(
1024
);
var
arrayBuffer
=
new
ArrayBuffer
(
1024
);
var
thatSer
=
new
xml
.
XmlSerializer
(
arrayBuffer
);
var
thatSer
=
new
xml
.
XmlSerializer
(
arrayBuffer
);
thatSer
.
startElement
(
"
note
"
);
thatSer
.
startElement
(
"
note
"
);
...
@@ -195,7 +195,7 @@ setCDATA(text: string): void
...
@@ -195,7 +195,7 @@ setCDATA(text: string): void
**示例:**
**示例:**
```
```
js
var
arrayBuffer
=
new
ArrayBuffer
(
1028
);
var
arrayBuffer
=
new
ArrayBuffer
(
1028
);
var
thatSer
=
new
xml
.
XmlSerializer
(
arrayBuffer
);
var
thatSer
=
new
xml
.
XmlSerializer
(
arrayBuffer
);
thatSer
.
setCDATA
(
'
root SYSTEM
'
)
// => '<![CDATA[root SYSTEM]]>';
thatSer
.
setCDATA
(
'
root SYSTEM
'
)
// => '<![CDATA[root SYSTEM]]>';
...
@@ -216,7 +216,7 @@ setText(text: string): void
...
@@ -216,7 +216,7 @@ setText(text: string): void
**示例:**
**示例:**
```
```
js
var
arrayBuffer
=
new
ArrayBuffer
(
1024
);
var
arrayBuffer
=
new
ArrayBuffer
(
1024
);
var
thatSer
=
new
xml
.
XmlSerializer
(
arrayBuffer
);
var
thatSer
=
new
xml
.
XmlSerializer
(
arrayBuffer
);
thatSer
.
startElement
(
"
note
"
);
thatSer
.
startElement
(
"
note
"
);
...
@@ -240,7 +240,7 @@ setDocType(text: string): void
...
@@ -240,7 +240,7 @@ setDocType(text: string): void
**示例:**
**示例:**
```
```
js
var
arrayBuffer
=
new
ArrayBuffer
(
1024
);
var
arrayBuffer
=
new
ArrayBuffer
(
1024
);
var
thatSer
=
new
xml
.
XmlSerializer
(
arrayBuffer
);
var
thatSer
=
new
xml
.
XmlSerializer
(
arrayBuffer
);
thatSer
.
setDocType
(
'
root SYSTEM
'
);
// => '<!DOCTYPE root SYSTEM>';
thatSer
.
setDocType
(
'
root SYSTEM
'
);
// => '<!DOCTYPE root SYSTEM>';
...
@@ -265,7 +265,7 @@ constructor(buffer: ArrayBuffer | DataView, encoding?: string)
...
@@ -265,7 +265,7 @@ constructor(buffer: ArrayBuffer | DataView, encoding?: string)
**示例:**
**示例:**
```
```
js
var
strXml
=
var
strXml
=
'
<?xml version="1.0" encoding="utf-8"?>
'
+
'
<?xml version="1.0" encoding="utf-8"?>
'
+
'
<note importance="high" logged="true">
'
+
'
<note importance="high" logged="true">
'
+
...
@@ -297,7 +297,7 @@ parse(option: ParseOptions): void
...
@@ -297,7 +297,7 @@ parse(option: ParseOptions): void
**示例:**
**示例:**
```
```
js
var
strXml
=
var
strXml
=
'
<?xml version="1.0" encoding="utf-8"?>
'
+
'
<?xml version="1.0" encoding="utf-8"?>
'
+
'
<note importance="high" logged="true">
'
+
'
<note importance="high" logged="true">
'
+
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录