Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
74e05859
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看板
未验证
提交
74e05859
编写于
9月 06, 2023
作者:
O
openharmony_ci
提交者:
Gitee
9月 06, 2023
浏览文件
操作
浏览文件
下载
差异文件
!24004 modify readme
Merge pull request !24004 from xixian/master
上级
24113968
bf7e1b1d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
24 addition
and
20 deletion
+24
-20
zh-cn/application-dev/reference/apis/js-apis-pointer.md
zh-cn/application-dev/reference/apis/js-apis-pointer.md
+24
-20
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-pointer.md
浏览文件 @
74e05859
...
@@ -31,7 +31,7 @@ setPointerVisible(visible: boolean, callback: AsyncCallback<void>): void
...
@@ -31,7 +31,7 @@ setPointerVisible(visible: boolean, callback: AsyncCallback<void>): void
```
js
```
js
try
{
try
{
pointer
.
setPointerVisible
(
true
,
(
error
)
=>
{
pointer
.
setPointerVisible
(
true
,
(
error
:
Error
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
`Set pointer visible failed, error:
${
JSON
.
stringify
(
error
,
[
`code`
,
`message`
])}
`
);
console
.
log
(
`Set pointer visible failed, error:
${
JSON
.
stringify
(
error
,
[
`code`
,
`message`
])}
`
);
return
;
return
;
...
@@ -123,7 +123,7 @@ isPointerVisible(): Promise<boolean>
...
@@ -123,7 +123,7 @@ isPointerVisible(): Promise<boolean>
```
js
```
js
try
{
try
{
pointer
.
isPointerVisible
().
then
((
visible
)
=>
{
pointer
.
isPointerVisible
().
then
((
visible
:
boolean
)
=>
{
console
.
log
(
`Get pointer visible success, visible:
${
JSON
.
stringify
(
visible
)}
`
);
console
.
log
(
`Get pointer visible success, visible:
${
JSON
.
stringify
(
visible
)}
`
);
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
...
@@ -279,7 +279,7 @@ setHoverScrollState(state: boolean, callback: AsyncCallback<void>): void
...
@@ -279,7 +279,7 @@ setHoverScrollState(state: boolean, callback: AsyncCallback<void>): void
```
js
```
js
try
{
try
{
pointer
.
setHoverScrollState
(
true
,
(
error
)
=>
{
pointer
.
setHoverScrollState
(
true
,
(
error
:
Error
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
`Set the mouse hover scroll failed, error:
${
JSON
.
stringify
(
error
,
[
`code`
,
`message`
])}
`
);
console
.
log
(
`Set the mouse hover scroll failed, error:
${
JSON
.
stringify
(
error
,
[
`code`
,
`message`
])}
`
);
return
;
return
;
...
@@ -402,7 +402,7 @@ setMousePrimaryButton(primary: PrimaryButton, callback: AsyncCallback<void>
...
@@ -402,7 +402,7 @@ setMousePrimaryButton(primary: PrimaryButton, callback: AsyncCallback<void>
```
js
```
js
try
{
try
{
pointer
.
setMousePrimaryButton
(
pointer
.
PrimaryButton
.
RIGHT
,
(
error
)
=>
{
pointer
.
setMousePrimaryButton
(
pointer
.
PrimaryButton
.
RIGHT
,
(
error
:
Error
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
`Set mouse primary button failed, error:
${
JSON
.
stringify
(
error
,
[
`code`
,
`message`
])}
`
);
console
.
log
(
`Set mouse primary button failed, error:
${
JSON
.
stringify
(
error
,
[
`code`
,
`message`
])}
`
);
return
;
return
;
...
@@ -656,9 +656,11 @@ getPointerStyle(windowId: number, callback: AsyncCallback<PointerStyle>):
...
@@ -656,9 +656,11 @@ getPointerStyle(windowId: number, callback: AsyncCallback<PointerStyle>):
**示例**
:
**示例**
:
```
js
```
js
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
window
from
'
@ohos.window
'
;
import
window
from
'
@ohos.window
'
;
window
.
getLastWindow
(
this
.
context
,
(
error
,
win
)
=>
{
let
context
=
getContext
(
this
);
window
.
getLastWindow
(
context
,
(
error
:
BusinessError
,
win
:
window
.
Window
)
=>
{
if
(
error
.
code
)
{
if
(
error
.
code
)
{
console
.
error
(
'
Failed to obtain the top window. Cause:
'
+
JSON
.
stringify
(
error
));
console
.
error
(
'
Failed to obtain the top window. Cause:
'
+
JSON
.
stringify
(
error
));
return
;
return
;
...
@@ -669,7 +671,7 @@ window.getLastWindow(this.context, (error, win) => {
...
@@ -669,7 +671,7 @@ window.getLastWindow(this.context, (error, win) => {
return
;
return
;
}
}
try
{
try
{
pointer
.
getPointerStyle
(
windowId
,
(
error
,
s
tyle
)
=>
{
pointer
.
getPointerStyle
(
windowId
,
(
error
:
Error
,
style
:
pointer
.
PointerS
tyle
)
=>
{
console
.
log
(
`Get pointer style success, style:
${
JSON
.
stringify
(
style
)}
`
);
console
.
log
(
`Get pointer style success, style:
${
JSON
.
stringify
(
style
)}
`
);
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
...
@@ -702,8 +704,10 @@ getPointerStyle(windowId: number): Promise<PointerStyle>
...
@@ -702,8 +704,10 @@ getPointerStyle(windowId: number): Promise<PointerStyle>
```
js
```
js
import
window
from
'
@ohos.window
'
;
import
window
from
'
@ohos.window
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
window
.
getLastWindow
(
this
.
context
,
(
error
,
win
)
=>
{
let
context
=
getContext
(
this
);
window
.
getLastWindow
(
context
,
(
error
:
BusinessError
,
win
:
window
.
Window
)
=>
{
if
(
error
.
code
)
{
if
(
error
.
code
)
{
console
.
error
(
'
Failed to obtain the top window. Cause:
'
+
JSON
.
stringify
(
error
));
console
.
error
(
'
Failed to obtain the top window. Cause:
'
+
JSON
.
stringify
(
error
));
return
;
return
;
...
@@ -714,7 +718,7 @@ window.getLastWindow(this.context, (error, win) => {
...
@@ -714,7 +718,7 @@ window.getLastWindow(this.context, (error, win) => {
return
;
return
;
}
}
try
{
try
{
pointer
.
getPointerStyle
(
windowId
).
then
((
style
)
=>
{
pointer
.
getPointerStyle
(
windowId
).
then
((
style
:
pointer
.
PointerStyle
)
=>
{
console
.
log
(
`Get pointer style success, style:
${
JSON
.
stringify
(
style
)}
`
);
console
.
log
(
`Get pointer style success, style:
${
JSON
.
stringify
(
style
)}
`
);
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
...
@@ -877,7 +881,7 @@ setTouchpadScrollSwitch(state: boolean, callback: AsyncCallback\<void>): void
...
@@ -877,7 +881,7 @@ setTouchpadScrollSwitch(state: boolean, callback: AsyncCallback\<void>): void
```
js
```
js
try
{
try
{
pointer
.
setTouchpadScrollSwitch
(
true
,
(
error
)
=>
{
pointer
.
setTouchpadScrollSwitch
(
true
,
(
error
:
Error
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
`setTouchpadScrollSwitch failed, error:
${
JSON
.
stringify
(
error
,
[
`code`
,
`message`
])}
`
);
console
.
log
(
`setTouchpadScrollSwitch failed, error:
${
JSON
.
stringify
(
error
,
[
`code`
,
`message`
])}
`
);
return
;
return
;
...
@@ -943,7 +947,7 @@ getTouchpadScrollSwitch(callback: AsyncCallback\<boolean>): void
...
@@ -943,7 +947,7 @@ getTouchpadScrollSwitch(callback: AsyncCallback\<boolean>): void
```
js
```
js
try
{
try
{
pointer
.
getTouchpadScrollSwitch
((
error
,
state
)
=>
{
pointer
.
getTouchpadScrollSwitch
((
error
:
Error
,
state
:
Boolean
)
=>
{
console
.
log
(
`getTouchpadScrollSwitch success, state:
${
JSON
.
stringify
(
state
)}
`
);
console
.
log
(
`getTouchpadScrollSwitch success, state:
${
JSON
.
stringify
(
state
)}
`
);
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
...
@@ -1066,7 +1070,7 @@ getTouchpadScrollDirection(callback: AsyncCallback\<boolean>): void
...
@@ -1066,7 +1070,7 @@ getTouchpadScrollDirection(callback: AsyncCallback\<boolean>): void
```
js
```
js
try
{
try
{
pointer
.
getTouchpadScrollSwitch
((
error
,
state
)
=>
{
pointer
.
getTouchpadScrollSwitch
((
error
:
Error
,
state
:
boolean
)
=>
{
console
.
log
(
`getTouchpadScrollDirection success, state:
${
JSON
.
stringify
(
state
)}
`
);
console
.
log
(
`getTouchpadScrollDirection success, state:
${
JSON
.
stringify
(
state
)}
`
);
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
...
@@ -1217,7 +1221,7 @@ getTouchpadTapSwitch(): Promise\<boolean>
...
@@ -1217,7 +1221,7 @@ getTouchpadTapSwitch(): Promise\<boolean>
```
js
```
js
try
{
try
{
pointer
.
getTouchpadTapSwitch
().
then
((
state
)
=>
{
pointer
.
getTouchpadTapSwitch
().
then
((
state
:
Boolean
)
=>
{
console
.
log
(
`getTouchpadTapSwitch success, state:
${
JSON
.
stringify
(
state
)}
`
);
console
.
log
(
`getTouchpadTapSwitch success, state:
${
JSON
.
stringify
(
state
)}
`
);
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
...
@@ -1312,7 +1316,7 @@ getTouchpadPointerSpeed(callback: AsyncCallback\<number>): void
...
@@ -1312,7 +1316,7 @@ getTouchpadPointerSpeed(callback: AsyncCallback\<number>): void
```
js
```
js
try
{
try
{
pointer
.
getTouchpadPointerSpeed
((
error
,
speed
)
=>
{
pointer
.
getTouchpadPointerSpeed
((
error
:
Error
,
speed
:
number
)
=>
{
console
.
log
(
`getTouchpadPointerSpeed success, speed:
${
JSON
.
stringify
(
speed
)}
`
);
console
.
log
(
`getTouchpadPointerSpeed success, speed:
${
JSON
.
stringify
(
speed
)}
`
);
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
...
@@ -1340,7 +1344,7 @@ getTouchpadPointerSpeed(): Promise\<number>
...
@@ -1340,7 +1344,7 @@ getTouchpadPointerSpeed(): Promise\<number>
```
js
```
js
try
{
try
{
pointer
.
getTouchpadPointerSpeed
().
then
((
speed
)
=>
{
pointer
.
getTouchpadPointerSpeed
().
then
((
speed
:
number
)
=>
{
console
.
log
(
`getTouchpadPointerSpeed success, speed:
${
JSON
.
stringify
(
speed
)}
`
);
console
.
log
(
`getTouchpadPointerSpeed success, speed:
${
JSON
.
stringify
(
speed
)}
`
);
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
...
@@ -1369,7 +1373,7 @@ setTouchpadPinchSwitch(state: boolean, callback: AsyncCallback\<void>): void
...
@@ -1369,7 +1373,7 @@ setTouchpadPinchSwitch(state: boolean, callback: AsyncCallback\<void>): void
```
js
```
js
try
{
try
{
pointer
.
setTouchpadTapSwitch
(
true
,
(
error
)
=>
{
pointer
.
setTouchpadTapSwitch
(
true
,
(
error
:
Error
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
`setTouchpadPinchSwitch failed, error:
${
JSON
.
stringify
(
error
,
[
`code`
,
`message`
])}
`
);
console
.
log
(
`setTouchpadPinchSwitch failed, error:
${
JSON
.
stringify
(
error
,
[
`code`
,
`message`
])}
`
);
return
;
return
;
...
@@ -1492,7 +1496,7 @@ setTouchpadSwipeSwitch(state: boolean, callback: AsyncCallback\<void>): void
...
@@ -1492,7 +1496,7 @@ setTouchpadSwipeSwitch(state: boolean, callback: AsyncCallback\<void>): void
```
js
```
js
try
{
try
{
pointer
.
setTouchpadSwipeSwitch
(
true
,
(
error
)
=>
{
pointer
.
setTouchpadSwipeSwitch
(
true
,
(
error
:
Error
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
`setTouchpadSwipeSwitch failed, error:
${
JSON
.
stringify
(
error
,
[
`code`
,
`message`
])}
`
);
console
.
log
(
`setTouchpadSwipeSwitch failed, error:
${
JSON
.
stringify
(
error
,
[
`code`
,
`message`
])}
`
);
return
;
return
;
...
@@ -1586,7 +1590,7 @@ getTouchpadSwipeSwitch(): Promise\<boolean>
...
@@ -1586,7 +1590,7 @@ getTouchpadSwipeSwitch(): Promise\<boolean>
```
js
```
js
try
{
try
{
pointer
.
getTouchpadSwipeSwitch
().
then
((
state
)
=>
{
pointer
.
getTouchpadSwipeSwitch
().
then
((
state
:
boolean
)
=>
{
console
.
log
(
`getTouchpadSwipeSwitch success, state:
${
JSON
.
stringify
(
state
)}
`
);
console
.
log
(
`getTouchpadSwipeSwitch success, state:
${
JSON
.
stringify
(
state
)}
`
);
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
...
@@ -1693,7 +1697,7 @@ getTouchpadRightClickType(callback: AsyncCallback\<RightClickType>): void
...
@@ -1693,7 +1697,7 @@ getTouchpadRightClickType(callback: AsyncCallback\<RightClickType>): void
```
js
```
js
try
{
try
{
pointer
.
getTouchpadRightClickType
((
error
,
t
ype
)
=>
{
pointer
.
getTouchpadRightClickType
((
error
:
Error
,
type
:
pointer
.
RightClickT
ype
)
=>
{
console
.
log
(
`getTouchpadRightClickType success, type:
${
JSON
.
stringify
(
type
)}
`
);
console
.
log
(
`getTouchpadRightClickType success, type:
${
JSON
.
stringify
(
type
)}
`
);
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
...
@@ -1871,7 +1875,7 @@ getPointerSize(): Promise<number>
...
@@ -1871,7 +1875,7 @@ getPointerSize(): Promise<number>
```
js
```
js
try
{
try
{
pointer
.
getPointerSize
().
then
((
size
)
=>
{
pointer
.
getPointerSize
().
then
((
size
:
number
)
=>
{
console
.
log
(
`getPointerSize success, size:
${
JSON
.
stringify
(
size
)}
`
);
console
.
log
(
`getPointerSize success, size:
${
JSON
.
stringify
(
size
)}
`
);
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
...
@@ -1927,7 +1931,7 @@ setPointerColor(color: number, callback: AsyncCallback<void>): void
...
@@ -1927,7 +1931,7 @@ setPointerColor(color: number, callback: AsyncCallback<void>): void
```
js
```
js
try
{
try
{
pointer
.
setPointerColor
(
0xF6C800
,
(
error
)
=>
{
pointer
.
setPointerColor
(
0xF6C800
,
(
error
:
Error
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
`setPointerColor failed, error:
${
JSON
.
stringify
(
error
,
[
`code`
,
`message`
])}
`
);
console
.
log
(
`setPointerColor failed, error:
${
JSON
.
stringify
(
error
,
[
`code`
,
`message`
])}
`
);
return
;
return
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录