scatterjs-core
Advanced tools
Comparing version 2.3.4 to 2.3.5
@@ -1,2 +0,2 @@ | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var plugin,_regenerator=_interopRequireDefault(require("@babel/runtime/regenerator")),_typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof")),_slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")),_asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_StorageService=_interopRequireDefault(require("./StorageService")),_getRandomValues=_interopRequireDefault(require("get-random-values")),_createHash=_interopRequireDefault(require("create-hash")),suffix="/socket.io/?EIO=3&transport=websocket",socket=null,connected=!1,paired=!1,openRequests=[],allowReconnects=!0,reconnectionTimeout=null,sha256=function(a){return(0,_createHash.default)("sha256").update(a).digest("hex")},random=function(){var a=new Uint8Array(24);return(0,_getRandomValues.default)(a),a.join("")},getOrigin=function(){var a;return a="undefined"==typeof location?plugin:location.hasOwnProperty("hostname")&&location.hostname.length&&"localhost"!==location.hostname?location.hostname:plugin,a},appkey=_StorageService.default.getAppKey();Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;appkey||(appkey="appkey:"+random());var send=function(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:null,b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:null;null===a&&null===b?socket.send("40/scatter"):socket.send("42/scatter,"+JSON.stringify([a,b]))},pairingPromise=null,pair=function(){var a=!!(0<arguments.length&&arguments[0]!==void 0)&&arguments[0];return new Promise(function(b,c){pairingPromise={resolve:b,reject:c},send("pair",{data:{appkey:appkey,origin:getOrigin(),passthrough:a},plugin:plugin})})},SocketService=/*#__PURE__*/function(){function a(){(0,_classCallCheck2.default)(this,a)}return(0,_createClass2.default)(a,null,[{key:"init",value:function init(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:6e4;plugin=a,this.timeout=b}},{key:"link",value:function link(){var a=this;return Promise.race([new Promise(function(b){return setTimeout(function(){connected||(b(!1),socket&&(socket.disconnect(),socket=null))},a.timeout)}),new Promise(/*#__PURE__*/function(){var a=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function a(b){var c,d;return _regenerator.default.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return c=function(){socket.onmessage=function(d){// Handshaking/Upgrading | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var plugin,_regenerator=_interopRequireDefault(require("@babel/runtime/regenerator")),_typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof")),_slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")),_asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_StorageService=_interopRequireDefault(require("./StorageService")),_getRandomValues=_interopRequireDefault(require("get-random-values")),_createHash=_interopRequireDefault(require("create-hash")),suffix="/socket.io/?EIO=3&transport=websocket",socket=null,connected=!1,paired=!1,openRequests=[],allowReconnects=!0,reconnectionTimeout=null,sha256=function(a){return(0,_createHash.default)("sha256").update(a).digest("hex")},random=function(){var a=new Uint8Array(24);return(0,_getRandomValues.default)(a),a.join("")},getOrigin=function(){var a;return a="undefined"==typeof location?plugin:location.hasOwnProperty("hostname")&&location.hostname.length&&"localhost"!==location.hostname?location.hostname:plugin,a.startWith("www.")&&(a=a.replace("www.","")),a},appkey=_StorageService.default.getAppKey();Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;appkey||(appkey="appkey:"+random());var send=function(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:null,b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:null;null===a&&null===b?socket.send("40/scatter"):socket.send("42/scatter,"+JSON.stringify([a,b]))},pairingPromise=null,pair=function(){var a=!!(0<arguments.length&&arguments[0]!==void 0)&&arguments[0];return new Promise(function(b,c){pairingPromise={resolve:b,reject:c},send("pair",{data:{appkey:appkey,origin:getOrigin(),passthrough:a},plugin:plugin})})},SocketService=/*#__PURE__*/function(){function a(){(0,_classCallCheck2.default)(this,a)}return(0,_createClass2.default)(a,null,[{key:"init",value:function init(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:6e4;plugin=a,this.timeout=b}},{key:"link",value:function link(){var a=this;return Promise.race([new Promise(function(b){return setTimeout(function(){connected||(b(!1),socket&&(socket.disconnect(),socket=null))},a.timeout)}),new Promise(/*#__PURE__*/function(){var a=(0,_asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function a(b){var c,d;return _regenerator.default.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return c=function(){socket.onmessage=function(d){// Handshaking/Upgrading | ||
if(-1===d.data.indexOf("42/scatter"))return!1;// Real message | ||
@@ -3,0 +3,0 @@ var e=JSON.parse(d.data.replace("42/scatter,","")),f=(0,_slicedToArray2.default)(e,2),g=f[0],h=f[1];return"paired"===g?a(h):"rekey"===g?b():"api"===g?c(h):void 0};var a=function(a){if(paired=a,paired){var b=_StorageService.default.getAppKey(),c=-1<appkey.indexOf("appkey:")?sha256(appkey):appkey;b&&b===c||(_StorageService.default.setAppKey(c),appkey=_StorageService.default.getAppKey())}pairingPromise.resolve(a)},b=function(){appkey="appkey:"+random(),send("rekeyed",{data:{appkey:appkey,origin:getOrigin()},plugin:plugin})},c=function(a){var b=openRequests.find(function(b){return b.id===a.id});if(b){openRequests=openRequests.filter(function(b){return b.id!==a.id});var c="object"===(0,_typeof2.default)(a.result)&&null!==a.result&&a.result.hasOwnProperty("isError");c?b.reject(a.result):b.resolve(a.result)}};// socket.on('event', event => { |
{ | ||
"name": "scatterjs-core", | ||
"version": "2.3.4", | ||
"version": "2.3.5", | ||
"main": "dist/index.js", | ||
@@ -11,3 +11,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "8ed43fa327957c4c13a4f1d4c36a3b36bf11648a" | ||
"gitHead": "0a5f12e4cc5cefbd4ba2105b718fc4a5a5b98c94" | ||
} |
@@ -34,2 +34,4 @@ import StorageService from './StorageService' | ||
else origin = plugin; | ||
if(origin.startWith('www.')) origin = origin.replace('www.',''); | ||
return origin; | ||
@@ -36,0 +38,0 @@ } |
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
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
51781
798