mirror of
https://github.com/irislib/iris-messenger.git
synced 2024-09-19 17:46:33 +00:00
add service worker
This commit is contained in:
parent
05bafdc3ea
commit
b929d6720a
@ -7,6 +7,21 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0">
|
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0">
|
||||||
<link rel="stylesheet" type="text/css" href="./style.css">
|
<link rel="stylesheet" type="text/css" href="./style.css">
|
||||||
<link rel="shortcut icon" href="./favicon.ico">
|
<link rel="shortcut icon" href="./favicon.ico">
|
||||||
|
<script>
|
||||||
|
if ('serviceWorker' in navigator) {
|
||||||
|
window.addEventListener('load', function() {
|
||||||
|
navigator.serviceWorker.register('serviceworker.js')
|
||||||
|
.then(function(registration) {
|
||||||
|
// Registration was successful
|
||||||
|
console.log('ServiceWorker registration successful with scope: ', registration.scope);
|
||||||
|
})
|
||||||
|
.catch(function(err) {
|
||||||
|
// registration failed :(
|
||||||
|
console.log('ServiceWorker registration failed: ', err);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
var gun = Gun({
|
var gun = Gun({
|
||||||
peers: [location.origin + '/gun', 'https://gun-us.herokuapp.com/gun', 'https://gunjs.herokuapp.com/gun'],
|
peers: [location.origin + '/gun', 'https://gun-us.herokuapp.com/gun', 'https://gunjs.herokuapp.com/gun']
|
||||||
});
|
});
|
||||||
var notificationSound = new Audio('./notification.mp3');
|
var notificationSound = new Audio('./notification.mp3');
|
||||||
var chat = gun.get('converse/' + location.hash.slice(1));
|
var chat = gun.get('converse/' + location.hash.slice(1));
|
||||||
|
Loading…
Reference in New Issue
Block a user