Skip to content

Commit

Permalink
Merge pull request #42 from drafear/develop
Browse files Browse the repository at this point in the history
fix: small bags
  • Loading branch information
drafear committed May 5, 2019
2 parents b6f52ef + 0122f36 commit 9ee05ca
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
24 changes: 12 additions & 12 deletions src/background/notification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@ export interface CreateNotificationParam {
export async function createNotification({ data, href }: CreateNotificationParam, lock: Lock) {
let notificationId: string;
await lock.acquire(async () => {
await new Promise(resolve => {
data.requireInteraction = true;
const clickHandler = (id: string) => {
if (id !== notificationId) {
return;
}
data.requireInteraction = true;
const clickHandler = (id: string) => {
if (id === notificationId) {
chrome.tabs.create({ url: href });
};
chrome.notifications.onClicked.addListener(clickHandler);
}
};
chrome.notifications.onClicked.addListener(clickHandler);
// create notification and get notification id
await new Promise(resolve => {
chrome.notifications.create(data, async id => {
console.log('create', id);
notificationId = id;
await sleep(8000);
chrome.notifications.clear(id);
await sleep(1000);
resolve();
});
});
await sleep(8000);
chrome.notifications.clear(notificationId);
chrome.notifications.onClicked.removeListener(clickHandler);
await sleep(1000);
});
}
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Comfortable Atcoder",
"version": "1.6.5",
"version": "1.6.6",
"manifest_version": 2,
"description": "Comfort your atcoder life. For more detail, visit https://github.com/drafear/comfortable-atcoder",
"author": "drafear",
Expand Down

0 comments on commit 9ee05ca

Please sign in to comment.