initial impl

This commit is contained in:
Dima Gerasimov 2019-01-04 20:14:41 +00:00
parent cc81dd9ba4
commit a0b30e893e
4 changed files with 42 additions and 4 deletions

View file

@ -1,7 +1,7 @@
{ {
"name": "chrome-extension-webpack", "name": "grasp-extension",
"version": "0.0.1", "version": "0.0.1",
"description": "A boilerplate to chrome extension with webpack", "description": "A reliable way of capturing web pages and content",
"scripts": { "scripts": {
"build": "node utils/build.js", "build": "node utils/build.js",
"start": "node utils/webserver.js" "start": "node utils/webserver.js"

View file

@ -1,2 +1,36 @@
import '../img/icon-128.png' import '../img/icon-128.png'
import '../img/icon-34.png' import '../img/icon-34.png'
// TODO wtf?? what does that import mean??
function makeCaptureRequest() {
var request = new XMLHttpRequest();
console.log('adadad');
// TODO configure port
request.open('POST', 'http://localhost:8000/capture', true);
// TODO request header??
request.onload = function() {
if (this.status >= 200 && this.status < 400) {
// Success!
var data = JSON.parse(this.response);
console.log(`SUCCESS ${data}`);
} else {
// We reached our target server, but it returned an error
}
};
request.onerror = function() {
console.log("ERROR!!!");
// There was a connection error of some sort
};
request.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
// xmlhttp.send(JSON.stringify({ "email": "hello@user.com", "response": { "name": "Tester" } }));
request.send(JSON.stringify({'name': 'alala', 'age': 10}));
}
makeCaptureRequest();

View file

@ -1,3 +1,4 @@
export default function () { export default function () {
alert("hello! (find me on src/js/popup/example.js)"); // alert("hello! (find me on src/js/popup/example.js)");
}; };

View file

@ -1,5 +1,5 @@
{ {
"name": "Chrome Extension Webpack", "name": "Grasp Extension",
"options_page": "options.html", "options_page": "options.html",
"background": { "background": {
"page": "background.html" "page": "background.html"
@ -8,6 +8,9 @@
"default_popup": "popup.html", "default_popup": "popup.html",
"default_icon": "icon-34.png" "default_icon": "icon-34.png"
}, },
"permissions": [
"http://*/"
],
"icons": { "icons": {
"128": "icon-128.png" "128": "icon-128.png"
}, },