-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathButtonFunctions.js
More file actions
47 lines (41 loc) · 1.09 KB
/
ButtonFunctions.js
File metadata and controls
47 lines (41 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
function share() {
shareOn('Tabbed Web App', 'Make your app awesome Automatically', 'https://tabbed.web.app')
}
function shareOn(title, alt, link) {
{
if (navigator.share) {
navigator.share({
title: alt,
text: title,
url: link
}).then(() => {
console.info("Shared")
}).catch(err => {
console.error(err)
});
} else {
console.error("Canceled")
}
}
}
window.addEventListener('beforeinstallprompt', (e) => {
e.preventDefault();
deferredPrompt = e;
});
async function pwainstall() {
deferredPrompt.prompt();
const { outcome } = await deferredPrompt.userChoice;
deferredPrompt = null;
if (outcome === 'accepted') {
console.log('User accepted the install prompt.');
} else if (outcome === 'dismissed') {
console.log('User dismissed the install prompt');
}
}
var urls = {
"TWA" : "https://tabbed.web.app"
}
function goTo(url){
console.log([url,urls.url])
location.href = urls[url]
}