@scatterjs/core
Advanced tools
Comparing version 2.7.28 to 2.7.29
@@ -1,1 +0,1 @@ | ||
"use strict";var _interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard"),_interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"SocketService",{enumerable:!0,get:function get(){return _SocketService["default"]}}),Object.defineProperty(exports,"Plugin",{enumerable:!0,get:function get(){return _Plugin["default"]}}),Object.defineProperty(exports,"Blockchains",{enumerable:!0,get:function get(){return _Blockchains.Blockchains}}),Object.defineProperty(exports,"Network",{enumerable:!0,get:function get(){return _Network["default"]}}),Object.defineProperty(exports,"WalletInterface",{enumerable:!0,get:function get(){return _WalletInterface["default"]}}),Object.defineProperty(exports,"WALLET_METHODS",{enumerable:!0,get:function get(){return _WalletInterface.WALLET_METHODS}}),exports.PluginTypes=exports["default"]=exports.EVENTS=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator")),_asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_PluginRepository=_interopRequireDefault(require("./plugins/PluginRepository")),_SocketService=_interopRequireDefault(require("./services/SocketService")),_Plugin=_interopRequireDefault(require("./plugins/Plugin")),PluginTypes=_interopRequireWildcard(require("./plugins/PluginTypes"));exports.PluginTypes=PluginTypes;var origin,_Blockchains=require("./models/Blockchains"),_Network=_interopRequireDefault(require("./models/Network")),_WalletInterface=_interopRequireWildcard(require("./models/WalletInterface")),_LocalSocket=_interopRequireDefault(require("./wallets/LocalSocket")),_RelaySocket=_interopRequireDefault(require("./wallets/RelaySocket")),_Injection=_interopRequireDefault(require("./wallets/Injection")),_Token=_interopRequireDefault(require("./models/Token")),EVENTS={Disconnected:"dced",LoggedOut:"logout"};exports.EVENTS=EVENTS;var socketSetters=[],holderFns={},Index=/*#__PURE__*/function(){function a(){(0,_classCallCheck2["default"])(this,a),this.identity=null,this.network=null,_PluginRepository["default"].loadPlugin(new _RelaySocket["default"](this,holderFns)),_PluginRepository["default"].loadPlugin(new _LocalSocket["default"](this,holderFns)),_PluginRepository["default"].loadPlugin(new _Injection["default"](this,holderFns))}return(0,_createClass2["default"])(a,[{key:"loadPlugin",value:function loadPlugin(a){if(!a.isValid())throw new Error("".concat(a.name," doesn't seem to be a valid ScatterJS plugin."));_PluginRepository["default"].loadPlugin(a),a.type===PluginTypes.BLOCKCHAIN_SUPPORT&&(this[a.name]=a.signatureProvider(function noIdFunc(){if(!holderFns.get().identity)throw new Error("No Identity")},function(){return holderFns.get().identity}),this[a.name+"Hook"]=a.hookProvider,socketSetters.push(a.setSocketService)),a.type===PluginTypes.WALLET_SUPPORT&&a.init(this,holderFns,socketSetters)}},{key:"connect",value:function(){var a=(0,_asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function a(b,c){var d;return _regenerator["default"].wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return c||(c={}),this.network=c.hasOwnProperty("network")?c.network:null,d=_PluginRepository["default"].wallets(),a.next=5,Promise.race(d.map(function(a){return a.connect(b,c).then(/*#__PURE__*/function(){var b=(0,_asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function b(c){return _regenerator["default"].wrap(function(b){for(;;)switch(b.prev=b.next){case 0:if(c&&socketSetters.map(function(a){return a(c)}),"function"!=typeof a.runBeforeInterfacing){b.next=4;break}return b.next=4,a.runBeforeInterfacing();case 4:if(new _WalletInterface["default"](a.name,a.methods(),holderFns.get()),"function"!=typeof a.runAfterInterfacing){b.next=8;break}return b.next=8,a.runAfterInterfacing();case 8:return _WalletInterface["default"].bindBasics(holderFns.get()),b.abrupt("return",!0);case 10:case"end":return b.stop();}},b)}));return function(){return b.apply(this,arguments)}}())}).concat(new Promise(function(a){return setTimeout(function(){return a(!1)},c.initTimeout||5e3)})));case 5:return a.abrupt("return",a.sent);case 6:case"end":return a.stop();}},a,this)}));return function connect(){return a.apply(this,arguments)}}()}]),a}(),Holder=/*#__PURE__*/function(){function a(b){(0,_classCallCheck2["default"])(this,a),this.scatter=b}return(0,_createClass2["default"])(a,[{key:"plugins",value:function plugins(){var a=this;if(!this.scatter.isExtension){for(var b=arguments.length,c=Array(b),d=0;d<b;d++)c[d]=arguments[d];c.map(function(b){return a.scatter.loadPlugin(b)})}}},{key:"connect",value:function connect(){var a;return(a=this.scatter).connect.apply(a,arguments)}},{key:"catchAll",value:function catchAll(){}}]),a}(),holder=new Proxy(new Holder(new Index()),{get:function get(a,b){return"undefined"==typeof a[b]?a.scatter[b]:a[b]}});holderFns.set=function(a){return holder.scatter=a},holderFns.get=function(){return holder.scatter},"undefined"!=typeof window&&(window.ScatterJS=holder),holder.Plugin=_Plugin["default"],holder.PluginTypes=PluginTypes,holder.Blockchains=_Blockchains.Blockchains,holder.Network=_Network["default"],holder.Token=_Token["default"],holder.SocketService=_SocketService["default"],holder.EVENTS=EVENTS,holder.WalletInterface=_WalletInterface["default"],holder.WALLET_METHODS=_WalletInterface.WALLET_METHODS;var _default=holder;exports["default"]=_default; | ||
"use strict";var _interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard"),_interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"SocketService",{enumerable:!0,get:function get(){return _SocketService["default"]}}),Object.defineProperty(exports,"Plugin",{enumerable:!0,get:function get(){return _Plugin["default"]}}),Object.defineProperty(exports,"Blockchains",{enumerable:!0,get:function get(){return _Blockchains.Blockchains}}),Object.defineProperty(exports,"Network",{enumerable:!0,get:function get(){return _Network["default"]}}),Object.defineProperty(exports,"WalletInterface",{enumerable:!0,get:function get(){return _WalletInterface["default"]}}),Object.defineProperty(exports,"WALLET_METHODS",{enumerable:!0,get:function get(){return _WalletInterface.WALLET_METHODS}}),exports.PluginTypes=exports["default"]=exports.EVENTS=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator")),_asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_PluginRepository=_interopRequireDefault(require("./plugins/PluginRepository")),_SocketService=_interopRequireDefault(require("./services/SocketService")),_Plugin=_interopRequireDefault(require("./plugins/Plugin")),PluginTypes=_interopRequireWildcard(require("./plugins/PluginTypes"));exports.PluginTypes=PluginTypes;var origin,_Blockchains=require("./models/Blockchains"),_Network=_interopRequireDefault(require("./models/Network")),_WalletInterface=_interopRequireWildcard(require("./models/WalletInterface")),_LocalSocket=_interopRequireDefault(require("./wallets/LocalSocket")),_RelaySocket=_interopRequireDefault(require("./wallets/RelaySocket")),_Injection=_interopRequireDefault(require("./wallets/Injection")),_Token=_interopRequireDefault(require("./models/Token")),EVENTS={Disconnected:"dced",LoggedOut:"logout"};exports.EVENTS=EVENTS;var socketSetters=[],holderFns={},Index=/*#__PURE__*/function(){function a(){(0,_classCallCheck2["default"])(this,a),this.identity=null,this.network=null,_PluginRepository["default"].loadPlugin(new _LocalSocket["default"](this,holderFns)),_PluginRepository["default"].loadPlugin(new _Injection["default"](this,holderFns))}return(0,_createClass2["default"])(a,[{key:"useRelay",value:function useRelay(){console.log("Using relay"),_PluginRepository["default"].loadPlugin(new _RelaySocket["default"](this,holderFns))}},{key:"loadPlugin",value:function loadPlugin(a){if(!a.isValid())throw new Error("".concat(a.name," doesn't seem to be a valid ScatterJS plugin."));_PluginRepository["default"].loadPlugin(a),a.type===PluginTypes.BLOCKCHAIN_SUPPORT&&(this[a.name]=a.signatureProvider(function noIdFunc(){if(!holderFns.get().identity)throw new Error("No Identity")},function(){return holderFns.get().identity}),this[a.name+"Hook"]=a.hookProvider,socketSetters.push(a.setSocketService)),a.type===PluginTypes.WALLET_SUPPORT&&a.init(this,holderFns,socketSetters)}},{key:"connect",value:function(){var a=(0,_asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function a(b,c){var d;return _regenerator["default"].wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return c||(c={}),this.network=c.hasOwnProperty("network")?c.network:null,d=_PluginRepository["default"].wallets(),a.next=5,Promise.race(d.map(function(a){return a.connect(b,c).then(/*#__PURE__*/function(){var b=(0,_asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function b(c){return _regenerator["default"].wrap(function(b){for(;;)switch(b.prev=b.next){case 0:if(c&&socketSetters.map(function(a){return a(c)}),"function"!=typeof a.runBeforeInterfacing){b.next=4;break}return b.next=4,a.runBeforeInterfacing();case 4:if(new _WalletInterface["default"](a.name,a.methods(),holderFns.get()),"function"!=typeof a.runAfterInterfacing){b.next=8;break}return b.next=8,a.runAfterInterfacing();case 8:return _WalletInterface["default"].bindBasics(holderFns.get()),b.abrupt("return",!0);case 10:case"end":return b.stop();}},b)}));return function(){return b.apply(this,arguments)}}())}).concat(new Promise(function(a){return setTimeout(function(){return a(!1)},c.initTimeout||5e3)})));case 5:return a.abrupt("return",a.sent);case 6:case"end":return a.stop();}},a,this)}));return function connect(){return a.apply(this,arguments)}}()}]),a}(),Holder=/*#__PURE__*/function(){function a(b){(0,_classCallCheck2["default"])(this,a),this.scatter=b}return(0,_createClass2["default"])(a,[{key:"plugins",value:function plugins(){var a=this;if(!this.scatter.isExtension){for(var b=arguments.length,c=Array(b),d=0;d<b;d++)c[d]=arguments[d];c.map(function(b){return a.scatter.loadPlugin(b)})}}},{key:"connect",value:function connect(){var a;return(a=this.scatter).connect.apply(a,arguments)}},{key:"catchAll",value:function catchAll(){}}]),a}(),holder=new Proxy(new Holder(new Index()),{get:function get(a,b){return"undefined"==typeof a[b]?a.scatter[b]:a[b]}});holderFns.set=function(a){return holder.scatter=a},holderFns.get=function(){return holder.scatter},"undefined"!=typeof window&&(window.ScatterJS=holder),holder.Plugin=_Plugin["default"],holder.PluginTypes=PluginTypes,holder.Blockchains=_Blockchains.Blockchains,holder.Network=_Network["default"],holder.Token=_Token["default"],holder.SocketService=_SocketService["default"],holder.EVENTS=EVENTS,holder.WalletInterface=_WalletInterface["default"],holder.WALLET_METHODS=_WalletInterface.WALLET_METHODS;var _default=holder;exports["default"]=_default; |
@@ -0,0 +0,0 @@ "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator")),_toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")),_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")),_isomorphicWs=_interopRequireDefault(require("isomorphic-ws")),_Device=_interopRequireDefault(require("../util/Device")),suffix="/socket.io/?EIO=3&transport=websocket",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("")},SocketService=/*#__PURE__*/function(){function a(b,c){(0,_classCallCheck2["default"])(this,a),this.plugin=b,this.timeout=c,this.uuid=null,this.socket=null,this.connected=!1,this.paired=!1,this.openRequests=[],this.pairingPromise=null,this.eventHandlers={},this.appkey=_StorageService["default"].getAppKey(),this.appkey||(this.appkey="appkey:"+random())}return(0,_createClass2["default"])(a,[{key:"getOrigin",value:function getOrigin(){return this.getOrigin()}},{key:"addEventHandler",value:function addEventHandler(a,b){b||(b="app"),this.eventHandlers[b]=a}},{key:"removeEventHandler",value:function removeEventHandler(a){a||(a="app"),delete this.eventHandlers[a]}},{key:"link",value:function link(){var a=this,b=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;return this.uuid=b,Promise.race([new Promise(function(b){return setTimeout(function(){a.connected||(b(!1),a.socket&&(a.socket.close(),a.socket=null))},a.timeout)}),new Promise(/*#__PURE__*/function(){var b=(0,_asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function b(d){var e,f,g,h,j,k;return _regenerator["default"].wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return e=function(){a.socket.onmessage=function(a){// Handshaking/Upgrading |
@@ -1,1 +0,1 @@ | ||
"use strict";var _interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard"),_interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator")),_asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_Plugin2=_interopRequireDefault(require("../plugins/Plugin")),_Blockchains=require("../models/Blockchains"),PluginTypes=_interopRequireWildcard(require("../plugins/PluginTypes")),_SocketService=_interopRequireDefault(require("../services/SocketService")),_index=require("../index"),_LocalSocket=_interopRequireDefault(require("./LocalSocket")),WEB_HOST="http://localhost:8081",SOCKET_HOST="localhost:50005",RelaySocket=/*#__PURE__*/function(a){function b(a,c){var d;return(0,_classCallCheck2["default"])(this,b),d=(0,_possibleConstructorReturn2["default"])(this,(0,_getPrototypeOf2["default"])(b).call(this,"RelaySocket",PluginTypes.WALLET_SUPPORT)),d.name="RelaySocket",d.context=a,d.holderFns=c,d}return(0,_inherits2["default"])(b,a),(0,_createClass2["default"])(b,[{key:"connect",value:function connect(a){var b=this,c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return new Promise(/*#__PURE__*/function(){var d=(0,_asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function d(e){var f;return _regenerator["default"].wrap(function(d){for(;;)switch(d.prev=d.next){case 0:if(a&&a.length){d.next=2;break}throw new Error("You must specify a name for this connection");case 2:return c=Object.assign({initTimeout:1e3,linkTimeout:3e3},c),d.next=5,fetch("".concat(WEB_HOST,"/app/connect")).then(function(a){return a.json()});case 5:if(f=d.sent,f){d.next=8;break}return d.abrupt("return",e(!1));case 8:b.socketService=new _SocketService["default"](a,c.linkTimeout),b.socketService.link(f,SOCKET_HOST).then(/*#__PURE__*/function(){var a=(0,_asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function a(c){return _regenerator["default"].wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(c){a.next=2;break}return a.abrupt("return",e(!1));case 2:return b.holderFns.get().isExtension=!1,b.holderFns.get().wallet||(b.holderFns.get().wallet=b.name),a.abrupt("return",e(b.socketService));case 5:case"end":return a.stop();}},a)}));return function(){return a.apply(this,arguments)}}());case 10:case"end":return d.stop();}},d)}));return function(){return d.apply(this,arguments)}}())}},{key:"runAfterInterfacing",value:function(){var a=(0,_asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function a(){var b=this;return _regenerator["default"].wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return this.holderFns.get().addEventHandler(function(a,c){return b.eventHandler(a,c)},"internal"),a.next=3,this.holderFns.get().getIdentityFromPermissions();case 3:return this.holderFns.get().identity=a.sent,a.abrupt("return",!0);case 5:case"end":return a.stop();}},a,this)}));return function runAfterInterfacing(){return a.apply(this,arguments)}}()},{key:"methods",value:function methods(){return _LocalSocket["default"].getMethods(this)}},{key:"eventHandler",value:function(){var a=(0,_asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function a(b){return _regenerator["default"].wrap(function(a){for(;;)switch(a.prev=a.next){case 0:a.t0=b,a.next=a.t0===_index.EVENTS.Disconnected?3:a.t0===_index.EVENTS.LoggedOut?5:9;break;case 3:return this.holderFns.get().identity=null,a.abrupt("break",9);case 5:return a.next=7,this.holderFns.get().getIdentityFromPermissions();case 7:return this.holderFns.get().identity=a.sent,a.abrupt("break",9);case 9:case"end":return a.stop();}},a,this)}));return function eventHandler(){return a.apply(this,arguments)}}()}]),b}(_Plugin2["default"]);exports["default"]=RelaySocket; | ||
"use strict";var _interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard"),_interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator")),_asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_Plugin2=_interopRequireDefault(require("../plugins/Plugin")),_Blockchains=require("../models/Blockchains"),PluginTypes=_interopRequireWildcard(require("../plugins/PluginTypes")),_SocketService=_interopRequireDefault(require("../services/SocketService")),_index=require("../index"),_LocalSocket=_interopRequireDefault(require("./LocalSocket")),WEB_HOST="http://localhost:50001",SOCKET_HOST="localhost:50005",RelaySocket=/*#__PURE__*/function(a){function b(a,c){var d;return(0,_classCallCheck2["default"])(this,b),d=(0,_possibleConstructorReturn2["default"])(this,(0,_getPrototypeOf2["default"])(b).call(this,"RelaySocket",PluginTypes.WALLET_SUPPORT)),d.name="RelaySocket",d.context=a,d.holderFns=c,d}return(0,_inherits2["default"])(b,a),(0,_createClass2["default"])(b,[{key:"connect",value:function connect(a){var b=this,c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return new Promise(/*#__PURE__*/function(){var d=(0,_asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function d(e){var f;return _regenerator["default"].wrap(function(d){for(;;)switch(d.prev=d.next){case 0:if(a&&a.length){d.next=2;break}throw new Error("You must specify a name for this connection");case 2:return c=Object.assign({initTimeout:1e3,linkTimeout:3e3},c),d.next=5,fetch("".concat(WEB_HOST,"/app/connect")).then(function(a){return a.json()});case 5:if(f=d.sent,f){d.next=8;break}return d.abrupt("return",e(!1));case 8:b.socketService=new _SocketService["default"](a,c.linkTimeout),b.socketService.link(f,SOCKET_HOST).then(/*#__PURE__*/function(){var a=(0,_asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function a(c){return _regenerator["default"].wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(c){a.next=2;break}return a.abrupt("return",e(!1));case 2:return b.holderFns.get().isExtension=!1,b.holderFns.get().wallet||(b.holderFns.get().wallet=b.name),a.abrupt("return",e(b.socketService));case 5:case"end":return a.stop();}},a)}));return function(){return a.apply(this,arguments)}}());case 10:case"end":return d.stop();}},d)}));return function(){return d.apply(this,arguments)}}())}},{key:"runAfterInterfacing",value:function(){var a=(0,_asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function a(){var b=this;return _regenerator["default"].wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return this.holderFns.get().addEventHandler(function(a,c){return b.eventHandler(a,c)},"internal"),a.next=3,this.holderFns.get().getIdentityFromPermissions();case 3:return this.holderFns.get().identity=a.sent,a.abrupt("return",!0);case 5:case"end":return a.stop();}},a,this)}));return function runAfterInterfacing(){return a.apply(this,arguments)}}()},{key:"methods",value:function methods(){return _LocalSocket["default"].getMethods(this)}},{key:"eventHandler",value:function(){var a=(0,_asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function a(b){return _regenerator["default"].wrap(function(a){for(;;)switch(a.prev=a.next){case 0:a.t0=b,a.next=a.t0===_index.EVENTS.Disconnected?3:a.t0===_index.EVENTS.LoggedOut?5:9;break;case 3:return this.holderFns.get().identity=null,a.abrupt("break",9);case 5:return a.next=7,this.holderFns.get().getIdentityFromPermissions();case 7:return this.holderFns.get().identity=a.sent,a.abrupt("break",9);case 9:case"end":return a.stop();}},a,this)}));return function eventHandler(){return a.apply(this,arguments)}}()}]),b}(_Plugin2["default"]);exports["default"]=RelaySocket; |
{ | ||
"name": "@scatterjs/core", | ||
"version": "2.7.28", | ||
"version": "2.7.29", | ||
"main": "dist/index.js", | ||
@@ -14,3 +14,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "d01d3974f836a879801485de010761ad0f5c0c2e", | ||
"gitHead": "6f068da78d4830860787f497b6d2e0e8920c461a", | ||
"publishConfig": { | ||
@@ -17,0 +17,0 @@ "access": "public" |
@@ -28,3 +28,2 @@ import PluginRepository from './plugins/PluginRepository'; | ||
PluginRepository.loadPlugin(new RelaySocket(this, holderFns)); | ||
PluginRepository.loadPlugin(new LocalSocket(this, holderFns)); | ||
@@ -34,2 +33,7 @@ PluginRepository.loadPlugin(new Injection(this, holderFns)); | ||
useRelay(){ | ||
console.log('Using relay') | ||
PluginRepository.loadPlugin(new RelaySocket(this, holderFns)); | ||
} | ||
loadPlugin(plugin){ | ||
@@ -36,0 +40,0 @@ const noIdFunc = () => { if(!holderFns.get().identity) throw new Error('No Identity') }; |
@@ -10,3 +10,3 @@ import Plugin from "../plugins/Plugin"; | ||
const WEB_HOST = `http://localhost:8081`; | ||
const WEB_HOST = `http://localhost:50001`; | ||
const SOCKET_HOST = `localhost:50005`; | ||
@@ -13,0 +13,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
97524
1016