Skip to content

Commit 0a8acae

Browse files
committed
add new event
1 parent ac9d785 commit 0a8acae

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

docs/en/guide/webuix/events.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,17 @@ WXEvent.on(window, "resume", (event) => {
7474
statusEl.style.color = getCssVar('success');
7575
// Add any additional logic needed when the app resumes
7676
});
77+
78+
// If you have nested scroll elements you may need to handle it on the JavaScript side
79+
WXEvent.on(window, 'refresh', () => {
80+
webui.setRefreshing(true);
81+
82+
if (confirm("Do you really wanna refresh the page?")) {
83+
location.reload()
84+
}
85+
86+
webui.setRefreshing(false);
87+
});
7788
```
7889
7990
### How It Works

docs/webui-x-types/config/Config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Require } from "./Require";
22

33
type BackInterceptor = "native" | "javascript" | boolean | null;
4+
type RefreshInterceptor = "native" | "javascript" | null;
45

56
export interface Config {
67
/**
@@ -49,6 +50,12 @@ export interface Config {
4950
*/
5051
backInterceptor: BackInterceptor;
5152

53+
/**
54+
* Whether the WebUI should handle the refresh button/gesture events. Requires `pullToRefresh` to be enabled.
55+
* @default null
56+
*/
57+
refreshInterceptor: RefreshInterceptor;
58+
5259
/**
5360
* Whether the WebUI should support pull-to-refresh functionality.
5461
* This is typically used in mobile web applications to allow users to refresh the content by pulling down.

0 commit comments

Comments
 (0)