Skip to content

Commit

Permalink
fix: typescript config
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelmord committed Jan 27, 2020
1 parent 9b005d7 commit aebe05f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions packages/browser-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"main": "index.js",
"scripts": {
"watch": "webpack --config webpack/webpack.dev.js --watch",
"prebuild": "yarn clean",
"build": "webpack --config webpack/webpack.prod.js",
"clean": "rimraf dist"
},
Expand Down
10 changes: 5 additions & 5 deletions packages/browser-extension/src/background.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
async function savePage<T>(url: string, title: string): Promise<T> {
async function savePage(url: string, title: string) {
return fetch('https://us-central1-poolbase-123.cloudfunctions.net/savePage', {
method: 'POST',
mode: 'cors',
Expand All @@ -12,20 +12,20 @@ async function savePage<T>(url: string, title: string): Promise<T> {
title,
}),
}).then(
(response): Promise<T> => {
(response) => {
if (!response.ok) {
throw new Error(response.statusText);
}
return response.json() as Promise<T>;
return response.json();
}
);
}

chrome.browserAction.onClicked.addListener(function(tab): void {
// Send a message to the active tab
chrome.tabs.query({ active: true, currentWindow: true }, async function(tabs): void {
chrome.tabs.query({ active: true, currentWindow: true }, async function(tabs) {
const activeTab = tabs[0];
const response = await savePage<{}>(activeTab.url, activeTab.title);
const response = await savePage(activeTab.url, activeTab.title);
console.log(response);
chrome.tabs.sendMessage(activeTab.id, {
message: 'clicked_browser_action',
Expand Down
1 change: 1 addition & 0 deletions packages/browser-extension/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"lib": ["es2018", "dom"],
"noImplicitAny": false,
"sourceMap": false,
"rootDir": "src",
Expand Down

0 comments on commit aebe05f

Please sign in to comment.