Skip to content

Commit

Permalink
Add a badge showing status
Browse files Browse the repository at this point in the history
  • Loading branch information
Pitu committed Jun 11, 2019
1 parent 6f089af commit 4433e08
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ browser.browserAction.onClicked.addListener(tab => {
history: []
}, async items => {
try {
browser.browserAction.setBadgeText({ text: 'Uploading' });
const response = await fetch('https://api.long.af/create', {
headers: { 'Content-Type': 'application/json' },
method: 'POST',
Expand All @@ -65,6 +66,8 @@ browser.browserAction.onClicked.addListener(tab => {
} catch (err) {
console.log(err.toString());
createNotification('basic', 'An error has occured!', err.toString(), true);
} finally {
browser.browserAction.setBadgeText({ text: '' });
}
});
});

0 comments on commit 4433e08

Please sign in to comment.