Skip to content

Commit

Permalink
Major changes: babel-runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
abhijithvijayan committed Jan 11, 2019
1 parent 930dee7 commit 7564e7e
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 55 deletions.
9 changes: 8 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
{
"presets": ["@babel/preset-env"]
"plugins": [
[
"@babel/plugin-transform-runtime",
{
"regenerator": true
}
]
]
}
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Download latest `Pre-Release`

[<img src=".github/assets/direct-download.png"
alt="Direct download"
height="70">](https://github.com/abhijithvijayan/kuttUrl-browser-extension/releases)
height="50">](https://github.com/abhijithvijayan/kuttUrl-browser-extension/releases)

## ToDO

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<a href="https://david-dm.org/abhijithvijayan/kuttUrl-browser-extension">
<img src="https://img.shields.io/david/abhijithvijayan/kuttUrl-browser-extension.svg?colorB=orange" alt="DEPENDENCIES" />
</a>
<a href="https://github.com/abhijithvijayan/kuttUrl-browser-extension">
<a href="https://github.com/abhijithvijayan/kuttUrl-browser-extension/blob/master/LICENSE">
<img src="https://img.shields.io/github/license/abhijithvijayan/kuttUrl-browser-extension.svg" alt="LICENSE" />
</a>
</div>
Expand Down Expand Up @@ -46,7 +46,7 @@

[<img src=".github/assets/direct-download.png"
alt="Direct download"
height="70">](https://github.com/abhijithvijayan/kuttUrl-browser-extension/releases/latest)
height="50">](https://github.com/abhijithvijayan/kuttUrl-browser-extension/releases/latest)

- Install in browser
- ### Chrome
Expand Down
58 changes: 34 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"license": "MIT",
"devDependencies": {
"@babel/core": "^7.2.2",
"@babel/plugin-transform-runtime": "^7.2.0",
"@babel/preset-env": "^7.2.3",
"autoprefixer": "^9.4.4",
"babel-loader": "^8.0.5",
Expand All @@ -34,8 +35,8 @@
"webpack-dev-server": "^3.1.14"
},
"dependencies": {
"axios": "^0.18.0",
"babel-polyfill": "^6.26.0"
"@babel/runtime": "^7.2.0",
"axios": "^0.18.0"
},
"description": "kuttUrl webextension",
"repository": {
Expand Down
22 changes: 9 additions & 13 deletions src/scripts/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,23 @@ async function getShortURL(API_key, URLtoShorten, password) {
// returns the promise
console.log("Returning Promise!");
return shortLink;

} catch (error) {
console.log(error);
}
};


function isShortened(request, sender, response) {
// Calling function
browser.runtime.onMessage.addListener(async (request, sender, response) => {
if(request.msg == "start") {
// consume the promise
getShortURL(request.API_key, request.pageUrl, request.password).then(
shortLink => {
return getShortURL(request.API_key, request.pageUrl, request.password)
.then(shortLink => {
console.log("URL:" + shortLink);
return shortLink;
}
);
console.log("Now here!");
return true;
})
.catch(err => {
console.log("Error Occured!");
});
}
}


// Calling function
browser.runtime.onMessage.addListener(isShortened);
});
6 changes: 1 addition & 5 deletions src/scripts/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,10 @@ document.addEventListener('DOMContentLoaded', () => {
password = result.pwd;

if(start === 'http' && API_key !== '' && API_key !== undefined) {

// send start message to background.js and receive response

browser.runtime.sendMessage({ msg: "start", API_key: `${API_key}`, pageUrl: `${longUrl}`, password: `${password}` }).then(response => {
// store the shortened link

console.log("Returning to UI!");
console.log(response);
console.log(typeof(response));
shortUrl = response;

document.getElementById('url__content-inner').textContent = "Error!!";
Expand Down
14 changes: 7 additions & 7 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = (env, options) => ({
entry: {
options: ["./src/scripts/options.js", './src/styles/options.scss'],
popup: ["./src/scripts/popup.js", './src/styles/popup.scss'],
background: ["babel-polyfill", "./src/scripts/background.js"]
background: ["./src/scripts/background.js"]
},
output: {
path: path.resolve(__dirname, "extension"),
Expand Down Expand Up @@ -119,12 +119,12 @@ module.exports = (env, options) => ({
},
canPrint: true
}),
new UglifyJsPlugin({
cache: true,
parallel: true,
sourceMap: false,
extractComments: false
}),
// new UglifyJsPlugin({
// cache: true,
// parallel: true,
// sourceMap: false,
// extractComments: false
// }),
]
},
devServer: {
Expand Down

0 comments on commit 7564e7e

Please sign in to comment.