@@ -34,21 +34,21 @@ To enable event handling in your module, add the following options to your confi
3434You can listen for events using the ` WXEvent ` API from the ` webuix ` package. Below are examples for handling the back button and custom pause actions:
3535
3636``` javascript
37- import { WXEvent } from " webuix" ;
37+ import { WXEventHandler } from " webuix" ;
3838
3939// Initialize the event system (recommended for best compatibility)
40- WXEvent . initialize ();
40+ window . wx = new WXEventHandler ()
4141
4242// Handle back event for a specific element (e.g., appDetails)
43- WXEvent .on (appDetails, " back" , (event ) => {
43+ wx .on (appDetails, " back" , (event ) => {
4444 if (appDetails .open ) {
4545 event .stopImmediatePropagation ();
4646 appDetails .open = false ; // Close the details panel
4747 }
4848});
4949
5050// Handle back event at the window level
51- WXEvent .on (window , " back" , (event ) => {
51+ wx .on (window , " back" , (event ) => {
5252 const appDetails = document .getElementById (" appDetails" );
5353
5454 if (appDetails? .open ) {
@@ -62,21 +62,21 @@ WXEvent.on(window, "back", (event) => {
6262});
6363
6464// Example: Listen for a custom pause event (replace with your own logic)
65- WXEvent .on (window , " pause" , (event ) => {
65+ wx .on (window , " pause" , (event ) => {
6666 focusInput .focus ();
6767 statusEl .textContent = ' App paused - input focused' ;
6868 statusEl .style .color = getCssVar (' error' );
6969});
7070
7171// Listen for resume events
72- WXEvent .on (window , " resume" , (event ) => {
72+ wx .on (window , " resume" , (event ) => {
7373 statusEl .textContent = ' App resumed' ;
7474 statusEl .style .color = getCssVar (' success' );
7575 // Add any additional logic needed when the app resumes
7676});
7777
7878// If you have nested scroll elements you may need to handle it on the JavaScript side
79- WXEvent .on (window , ' refresh' , () => {
79+ wx .on (window , ' refresh' , () => {
8080 webui .setRefreshing (true );
8181
8282 if (confirm (" Do you really wanna refresh the page?" )) {
0 commit comments