From 4ae64fc93e261ca83c734f13fb508fafef0321ce Mon Sep 17 00:00:00 2001 From: Sheen Tian Date: Wed, 4 Sep 2024 16:14:55 +0800 Subject: [PATCH] feat: add test cases for add/remove event listener --- example/QCefViewTest/index.in.html | 202 +++++++++++++++----------- example/QCefViewTest/tutorial.in.html | 145 ++++++++++-------- 2 files changed, 199 insertions(+), 148 deletions(-) diff --git a/example/QCefViewTest/index.in.html b/example/QCefViewTest/index.in.html index e6769cfe..cb61d092 100644 --- a/example/QCefViewTest/index.in.html +++ b/example/QCefViewTest/index.in.html @@ -1,97 +1,129 @@ - - - - - - -

Web Area

-
-
-

Dragging area

-
-
- - -
- -
-
- - -
- -
- -
-
+
+ +
+
- -
- Popup Browser By HTML -
- Popup Browser By Script + +
+ Popup Browser By HTML +
+ Popup Browser By + Script -
- Close Current Window +
+ Close Current Window -

An iframe with default borders:

- -
- - +

An iframe with default borders:

+ + + + + \ No newline at end of file diff --git a/example/QCefViewTest/tutorial.in.html b/example/QCefViewTest/tutorial.in.html index 428ec351..b6e3207c 100644 --- a/example/QCefViewTest/tutorial.in.html +++ b/example/QCefViewTest/tutorial.in.html @@ -1,76 +1,95 @@ - - - - + function onChangeColorEvent(color) { + console.log("request change background color to: ", color); + // change the background color + document.getElementById("main").style.backgroundColor = color; + } - -

Web Area

-
- -
- -
-
+ function onAddEventListener() { + // Add a event listener to handle the event named 'colorChange' + CallBridge.addEventListener( + // event name + "colorChange", + // event handler + onChangeColorEvent + ); + } - -
- -
- -
-
+ function onRemoveEventListener() { + // Add a event listener to handle the event named 'colorChange' + CallBridge.removeEventListener( + // event name + "colorChange", + // event handler + onChangeColorEvent + ); + } - -
- - + + + + \ No newline at end of file