forked from kishanrajput23/Java-Projects-Collections
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstrike.js
29 lines (26 loc) · 801 Bytes
/
strike.js
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
const kt = () => {
fetch("https://meme-api.herokuapp.com/gimme")
.then((data) => data.json())
.then((data_val) => {
const u_data = data_val.url;
document.getElementById("myImg").src = u_data;
console.log(u_data);
});
};
kt();
//function to refresh the page every 5 seconds
const myfunc = () =>{
kt();
}
//function to share the generated meme on social networks
function share(){
if (navigator.share !== undefined) {
navigator.share({
title: 'Meme Genrator',
text: 'meme generator',
url: 'u_data',
})
.then(() => console.log('Successful share'))
.catch((error) => console.log('Error sharing', error));
}
}