forked from MapComplete/MapComplete
Reformat all files with prettier
This commit is contained in:
parent
e22d189376
commit
b541d3eab4
382 changed files with 50893 additions and 35566 deletions
|
@ -1,17 +1,20 @@
|
|||
import BaseUIElement from "../BaseUIElement";
|
||||
import BaseUIElement from "../BaseUIElement"
|
||||
|
||||
export default class ShareButton extends BaseUIElement {
|
||||
private _embedded: BaseUIElement;
|
||||
private _shareData: () => { text: string; title: string; url: string };
|
||||
private _embedded: BaseUIElement
|
||||
private _shareData: () => { text: string; title: string; url: string }
|
||||
|
||||
constructor(embedded: BaseUIElement, generateShareData: () => {
|
||||
text: string,
|
||||
title: string,
|
||||
url: string
|
||||
}) {
|
||||
super();
|
||||
this._embedded = embedded;
|
||||
this._shareData = generateShareData;
|
||||
constructor(
|
||||
embedded: BaseUIElement,
|
||||
generateShareData: () => {
|
||||
text: string
|
||||
title: string
|
||||
url: string
|
||||
}
|
||||
) {
|
||||
super()
|
||||
this._embedded = embedded
|
||||
this._shareData = generateShareData
|
||||
this.SetClass("share-button")
|
||||
}
|
||||
|
||||
|
@ -20,21 +23,21 @@ export default class ShareButton extends BaseUIElement {
|
|||
e.type = "button"
|
||||
e.appendChild(this._embedded.ConstructElement())
|
||||
|
||||
e.addEventListener('click', () => {
|
||||
e.addEventListener("click", () => {
|
||||
if (navigator.share) {
|
||||
navigator.share(this._shareData()).then(() => {
|
||||
console.log('Thanks for sharing!');
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(`Couldn't share because of`, err.message);
|
||||
});
|
||||
navigator
|
||||
.share(this._shareData())
|
||||
.then(() => {
|
||||
console.log("Thanks for sharing!")
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(`Couldn't share because of`, err.message)
|
||||
})
|
||||
} else {
|
||||
console.log('web share not supported');
|
||||
console.log("web share not supported")
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
return e;
|
||||
return e
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue