Am new at Framework7 Great Api btw but i was wondering if there is anyway to create a pull-to-refresh that detects internet connection.
For example i want when the user refreshes the Home page to display a toast which checks for new content and when the user is not connected to the internet to display a offline a dialog which can tell the user to connect to the internet and direct them to there Internet Connection Settings but my code keeps on failing can someone help here is the JavaScript code:
export default {
data: function() {
return {
items: [],
}
},
methods: {
loadMore: function(e, done) {
setTimeout(function() {
function Connectionstatus() {
if (navigator.onLine) {
$.toast.create({
text: 'Checking For New Content...',
position: 'bottom',
cssclass: 'bg-color-darkgray',
destroyOnClose:true
}).open();
}
else {
app.dialog.create ({
text: 'Please Connect to the Internet.',
cssclass: 'custom-dialog',
closeByBackdropClick: 'true',
buttons: [
{
text: 'OK',
},
{
text: 'SETTING',
onclick: function () {
window.location.href = "";
}
}
]
}).open();
}
}
done();
}, 2000);
}
}
}