Skip to content

Instantly share code, notes, and snippets.

@tcannonfodder
Last active August 16, 2025 10:42
Show Gist options
  • Save tcannonfodder/d3671cea54207a5cb57f5661528d02b1 to your computer and use it in GitHub Desktop.
Save tcannonfodder/d3671cea54207a5cb57f5661528d02b1 to your computer and use it in GitHub Desktop.
Pull to Refresh + Web Awesome workaround for iOS
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