Last active
August 16, 2025 10:42
-
-
Save tcannonfodder/d3671cea54207a5cb57f5661528d02b1 to your computer and use it in GitHub Desktop.
Pull to Refresh + Web Awesome workaround for iOS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import PullToRefresh from 'pulltorefreshjs'; | |
var drawerOrPageShown = false | |
function afterShowEvent(event){ | |
const element = event.target | |
if(element.tagName != "WA-PAGE" && element.tagName != "WA-DRAWER") { | |
return | |
} | |
drawerOrPageShown = true | |
} | |
function afterHideEvent(event){ | |
const element = event.target | |
if(element.tagName != "WA-PAGE" && element.tagName != "WA-DRAWER") { | |
return | |
} | |
drawerOrPageShown = false | |
} | |
PullToRefresh.init({ | |
shouldPullToRefresh: function(){ | |
return (!window.scrollY && !drawerOrPageShown) | |
}, | |
onRefresh: function() { | |
window.location.reload() | |
} | |
}); | |
document.addEventListener(`wa-show`, afterShowEvent) | |
document.addEventListener(`wa-hide`, afterHideEvent) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment