Fix: Todo Multi refresh ...

fix some promises problem
This commit is contained in:
Paolo Arena
2019-02-14 18:38:23 +01:00
parent e8d2d49829
commit 6931d57005
22 changed files with 281 additions and 163 deletions

View File

@@ -59,7 +59,8 @@ export default class Home extends Vue {
window.addEventListener('beforeinstallprompt', function (event) {
// console.log('******************************** beforeinstallprompt fired')
event.preventDefault()
console.log('§§§§§§§§§§§§§§§§§§§§ IMPOSTA DEFERRED PROMPT !!!!!!!!!!!!!!!!! ')
// console.log('§§§§§§§§§§§§§§§§§§§§ IMPOSTA DEFERRED PROMPT !!!!!!!!!!!!!!!!! ')
// #Todo++ IMPOSTA DEFERRED PROMPT
return false
})
@@ -69,6 +70,10 @@ export default class Home extends Vue {
return Notification.permission
}
NotServiceWorker () {
return (!('serviceWorker' in navigator))
}
displayConfirmNotification() {
let options = null
if ('serviceWorker' in navigator) {
@@ -88,10 +93,12 @@ export default class Home extends Vue {
]
}
navigator.serviceWorker.ready
.then(function (swreg) {
swreg.showNotification('Successfully subscribed!', options)
})
if ('serviceWorker' in navigator) {
navigator.serviceWorker.ready
.then(function (swreg) {
swreg.showNotification('Successfully subscribed!', options)
})
}
}
}
@@ -168,7 +175,6 @@ export default class Home extends Vue {
}
test_fetch() {
fetch('https:/httpbin.org/post', {
method: 'POST',

View File

@@ -5,6 +5,8 @@
<q-btn v-if="getPermission() !== 'granted'" class="enable-notifications" color="primary" rounded size="lg" icon="notifications" @click="askfornotification" :label="$t('notification.ask')"/>
<q-btn v-if="getPermission() === 'granted'" class="enable-notifications" color="primary" rounded size="lg" icon="notifications" @click="showNotificationExample" label="Send Notification"/>
<!--<q-btn v-if="getPermission() === 'granted'" class="enable-notifications" color="secondary" rounded size="lg" icon="notifications" @click="createPushSubscription" label="Create Push Subscription !"/>-->
<br>
<div>
<q-chip square color="secondary">
@@ -16,6 +18,12 @@
:label="$t('notification.titlegranted')"
helper="Stato Notifiche">
</q-field>
<q-field
v-if="NotServiceWorker()"
icon="notifications"
label="Service Worker not present"
>
</q-field>
</div>
</q-page>