terminal:
npm i --save-dev rollup rollup-watch rollup-plugin-typescript typescript typings
npm i -S react react-dom
./node_modules/.bin/typings install react react-dom --save
mkdir src dist
touch src/index.tsx
/* Using a JavaScript proxy for a super low code REST client */ | |
// via https://dev.to/dipsaus9/javascript-lets-create-aproxy-19hg | |
// also see https://towardsdatascience.com/why-to-use-javascript-proxy-5cdc69d943e3 | |
// also see https://github.com/fastify/manifetch | |
// also see https://github.com/flash-oss/allserver | |
// and https://gist.github.com/v1vendi/75d5e5dad7a2d1ef3fcb48234e4528cb | |
const createApi = (url) => { | |
return new Proxy({}, { | |
get(target, key) { |
terminal:
npm i --save-dev rollup rollup-watch rollup-plugin-typescript typescript typings
npm i -S react react-dom
./node_modules/.bin/typings install react react-dom --save
mkdir src dist
touch src/index.tsx
var exec = require('child_process').exec, | |
url = "http://google.com/", | |
timeout = "3", | |
data="?q=test"; | |
var time = process.hrtime(); | |
exec('curl --max-time ' + timeout + ' -d \'' + data + '\' ' + url, function (error, stdout, stderr) { | |
var diff = process.hrtime(time); | |
//console.log('stdout: ' + stdout); | |
//console.log('stderr: ' + stderr); |
var GEO_LOCATION = { | |
watchID: null, | |
callback: null | |
}; | |
GEO_LOCATION.mySpot = function(position){ | |
var lat = (position.coords) ? new String(position.coords.latitude) : position.x; | |
var lon = (position.coords) ? new String(position.coords.longitude) : position.y; | |
return GEO_LOCATION.callback(lat, lon); | |
} |