-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.js
29 lines (25 loc) · 790 Bytes
/
utils.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 baseUrl = "http://localhost:8089/";
const notify = (type, desc) => {
chrome.notifications.create("notificationId", {
type: 'basic',
title: `ToDo - ${type}`,
message: desc,
iconUrl: 'assets/logo.png'
}, (notificationId) => {
setTimeout(() => {
chrome.notifications.clear(notificationId);
}, 6000);
});
};
const isInternetConnected = async (callback) => {
fetch('https://www.google.com', { method: 'HEAD', mode: 'no-cors'})
.then(response => {
callback(true);
console.log("Connected to internet...");
})
.catch(error => {
callback(false);
console.log("Can't connect to the internet...");
});
}
export { notify, baseUrl, isInternetConnected};