未验证 提交 40f068f1 编写于 作者: O openharmony_ci 提交者: Gitee

!24036 ArkTS适配

Merge pull request !24036 from sunwenyu/cherry-pick-1693968805
......@@ -33,7 +33,7 @@ on(type: 'drag', callback: Callback<DragState>): void;
```js
try {
dragInteraction.on('drag', (data) => {
dragInteraction.on('drag', (data : DragState) => {
console.log(`Drag interaction event: ${JSON.stringify(data)}`);
});
} catch (error) {
......@@ -60,25 +60,25 @@ off(type: 'drag', callback?: Callback<DragState>): void;
```js
// 取消注册单个回调函数
function callback(event) {
function single_callback(event : DragState) {
console.log(`Drag interaction event: ${JSON.stringify(event)}`);
return false;
}
try {
dragInteraction.on('drag', callback);
dragInteraction.off("drag", callback);
dragInteraction.on('drag', single_callback);
dragInteraction.off("drag", single_callback);
} catch (error) {
console.log(`Execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
```js
// 取消注册所有回调函数
function callback(event) {
function all_callback(event : DragState) {
console.log(`Drag interaction event: ${JSON.stringify(event)}`);
return false;
}
try {
dragInteraction.on('drag', callback);
dragInteraction.on('drag', all_callback);
dragInteraction.off("drag");
} catch (error) {
console.log(`Execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册