exaquark-js
Advanced tools
Comparing version 1.0.8 to 1.0.10
{ | ||
"name": "exaquark-js", | ||
"version": "1.0.8", | ||
"version": "1.0.10", | ||
"description": "JS wrapper for exaquark.com", | ||
"main": "./lib/index.js", | ||
"main": "./index.js", | ||
"scripts": { | ||
"clean": "rimraf lib", | ||
"clean": "rimraf lib utils index.js helpers.js", | ||
"test": "cross-env BABEL_ENV=commonjs mocha --compilers js:babel-register --recursive", | ||
@@ -13,3 +13,3 @@ "test:watch": "npm test -- --watch", | ||
"lint": "eslint src test", | ||
"build": "cross-env BABEL_ENV=commonjs babel src --out-dir lib", | ||
"build": "cross-env BABEL_ENV=commonjs babel src --out-dir ./", | ||
"prepublish": "npm run clean && npm run lint && npm run test && npm run build", | ||
@@ -64,3 +64,5 @@ "docs": "./node_modules/.bin/jsdoc -c ./conf/jsdoc.json", | ||
}, | ||
"dependencies": {} | ||
"dependencies": { | ||
"xhr": "^2.4.1" | ||
} | ||
} |
@@ -37,2 +37,11 @@ # exaQuark JS | ||
##### 1.0.10 | ||
- Changing native XMLHttpRequest to xhr | ||
##### 1.0.9 | ||
- Changing JSONP to AJAX for allocator | ||
- Moving code from `lib` to root folder | ||
##### 1.0.8 | ||
@@ -39,0 +48,0 @@ |
@@ -0,0 +0,0 @@ import { distanceOnSphere } from './utils/distance' |
@@ -1,30 +0,30 @@ | ||
import { log } from './utils/private' | ||
import { log, getRequest } from './utils/private' | ||
import { dictionaryToArray } from './helpers' | ||
const loadJSONP = (() => { | ||
let unique = 0 | ||
return (url, callback, context) => { | ||
// INIT | ||
let name = '_jsonp_' + unique++ | ||
if (url.match(/\?/)) url += '&callback=' + name | ||
else url += '?callback=' + name | ||
// const loadJSONP = (() => { | ||
// let unique = 0 | ||
// return (url, callback, context) => { | ||
// // INIT | ||
// let name = '_jsonp_' + unique++ | ||
// if (url.match(/\?/)) url += '&callback=' + name | ||
// else url += '?callback=' + name | ||
// | ||
// // Create script | ||
// let script = document.createElement('script') | ||
// script.type = 'text/javascript' | ||
// script.src = url | ||
// | ||
// // Setup handler | ||
// window[name] = data => { | ||
// callback.call((context || window), data) | ||
// document.getElementsByTagName('head')[0].removeChild(script) | ||
// script = null | ||
// delete window[name] | ||
// } | ||
// | ||
// // Load JSON | ||
// document.getElementsByTagName('head')[0].appendChild(script) | ||
// } | ||
// })() | ||
// Create script | ||
let script = document.createElement('script') | ||
script.type = 'text/javascript' | ||
script.src = url | ||
// Setup handler | ||
window[name] = data => { | ||
callback.call((context || window), data) | ||
document.getElementsByTagName('head')[0].removeChild(script) | ||
script = null | ||
delete window[name] | ||
} | ||
// Load JSON | ||
document.getElementsByTagName('head')[0].appendChild(script) | ||
} | ||
})() | ||
/** | ||
@@ -69,3 +69,5 @@ * Represents an exaQuark instance | ||
return new Promise((resolve, reject) => { | ||
loadJSONP(this.allocatorUrl, response => { | ||
getRequest(this.allocatorUrl, (err, response) => { | ||
console.log('err', err) | ||
console.log('response', response) | ||
this.entryPoint = response.entryPoint | ||
@@ -72,0 +74,0 @@ this.iid = response.iid |
@@ -0,0 +0,0 @@ var exports = module.exports = {} |
@@ -0,1 +1,2 @@ | ||
const xhr = require('xhr') | ||
var exports = module.exports = {} | ||
@@ -7,1 +8,7 @@ | ||
} | ||
exports.getRequest = function (url, callback) { | ||
xhr.get(url, (err, resp) => { | ||
callback(err, JSON.parse(resp.body)) | ||
}) | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
53
23437
1
7
621
1
+ Addedxhr@^2.4.1
+ Addeddom-walk@0.1.2(transitive)
+ Addedglobal@4.4.0(transitive)
+ Addedis-function@1.0.2(transitive)
+ Addedmin-document@2.19.0(transitive)
+ Addedparse-headers@2.0.5(transitive)
+ Addedprocess@0.11.10(transitive)
+ Addedxhr@2.6.0(transitive)
+ Addedxtend@4.0.2(transitive)