Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9ac1fdbb63 | |||
| ac43f63daf | |||
| c8ce7942d5 | |||
| 336351b98a |
64
package-lock.json
generated
64
package-lock.json
generated
@@ -1,20 +1,20 @@
|
||||
{
|
||||
"name": "@designestate/dees-comms",
|
||||
"version": "1.0.7",
|
||||
"version": "1.0.9",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@apiglobal/typedrequest": {
|
||||
"version": "1.0.53",
|
||||
"resolved": "https://verdaccio.lossless.one/@apiglobal%2ftypedrequest/-/typedrequest-1.0.53.tgz",
|
||||
"integrity": "sha512-9KfG+ZfhryepIY1Q++OIMSU6k3Qy1MGRPXPLXQyPua5uXgHTPgT59+pczwpTAo1Mru4o0H87Xtwt596HV7FGsg==",
|
||||
"version": "1.0.56",
|
||||
"resolved": "https://verdaccio.lossless.one/@apiglobal%2ftypedrequest/-/typedrequest-1.0.56.tgz",
|
||||
"integrity": "sha512-FH5bY8t1XqdPL2gXzlIydmzpv0BV8WWCAQVyWIM7kqQ/j0EI5sgoCkqYFFh/FWrsvPBx7qM288zC157Btwcycg==",
|
||||
"requires": {
|
||||
"@apiglobal/typedrequest-interfaces": "^1.0.15",
|
||||
"@pushrocks/isounique": "^1.0.4",
|
||||
"@pushrocks/lik": "^4.0.17",
|
||||
"@pushrocks/smartdelay": "^2.0.10",
|
||||
"@pushrocks/smartpromise": "^3.0.6",
|
||||
"@pushrocks/webrequest": "^2.0.10"
|
||||
"@pushrocks/webrequest": "^2.0.12"
|
||||
}
|
||||
},
|
||||
"@apiglobal/typedrequest-interfaces": {
|
||||
@@ -2040,13 +2040,28 @@
|
||||
}
|
||||
},
|
||||
"@pushrocks/webrequest": {
|
||||
"version": "2.0.10",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fwebrequest/-/webrequest-2.0.10.tgz",
|
||||
"integrity": "sha512-uQ8MvKclGqdLaUjah3SUsr8RplvtEUDXpFYjyO1dsHabbLWNVPQipt70CAMvS/8hOzDDD/G+dUEHIz2yZSVKNQ==",
|
||||
"version": "2.0.13",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fwebrequest/-/webrequest-2.0.13.tgz",
|
||||
"integrity": "sha512-FNRthRBrBmc3Eu+NRkVrPudbmWMphph/Y15feHo7tUj7Y4MhP0uSy2/95vM3b5LcXQldOEH3GA9SB7VYJ1+VPw==",
|
||||
"requires": {
|
||||
"@pushrocks/smartdelay": "^2.0.9",
|
||||
"@pushrocks/smartenv": "^4.0.10",
|
||||
"node-fetch": "^2.6.0"
|
||||
"@pushrocks/smartdelay": "^2.0.10",
|
||||
"@pushrocks/smartenv": "^4.0.15",
|
||||
"@pushrocks/smartjson": "^4.0.5",
|
||||
"node-fetch": "^2.6.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pushrocks/smartjson": {
|
||||
"version": "4.0.5",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartjson/-/smartjson-4.0.5.tgz",
|
||||
"integrity": "sha512-i4kBjZSbs1t8swcAPEdPkDJHci2higzvMIkNUKTgXWrcxUFMuOis/B5huUnnIqg/Td8R+mAdf/B/CMfgjABTlg==",
|
||||
"requires": {
|
||||
"@types/buffer-json": "^2.0.0",
|
||||
"@types/fast-json-stable-stringify": "^2.0.0",
|
||||
"buffer-json": "^2.0.0",
|
||||
"fast-json-stable-stringify": "^2.1.0",
|
||||
"lodash.clonedeep": "^4.5.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@rollup/plugin-commonjs": {
|
||||
@@ -2148,8 +2163,7 @@
|
||||
"@types/buffer-json": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2fbuffer-json/-/buffer-json-2.0.0.tgz",
|
||||
"integrity": "sha512-nFKOrY93Tvv5Tobws+YbkGlPOJsn1nVpZah3BlSyQ4EniFm97KLvSr54tZ5xQp8mlf/XxbYwskNCYQB9EdrPlQ==",
|
||||
"dev": true
|
||||
"integrity": "sha512-nFKOrY93Tvv5Tobws+YbkGlPOJsn1nVpZah3BlSyQ4EniFm97KLvSr54tZ5xQp8mlf/XxbYwskNCYQB9EdrPlQ=="
|
||||
},
|
||||
"@types/chai": {
|
||||
"version": "4.2.13",
|
||||
@@ -2240,8 +2254,7 @@
|
||||
"@types/fast-json-stable-stringify": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2ffast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",
|
||||
"integrity": "sha512-mky/O83TXmGY39P1H9YbUpjV6l6voRYlufqfFCvel8l1phuy8HRjdWc1rrPuN53ITBJlbyMSV6z3niOySO5pgQ==",
|
||||
"dev": true
|
||||
"integrity": "sha512-mky/O83TXmGY39P1H9YbUpjV6l6voRYlufqfFCvel8l1phuy8HRjdWc1rrPuN53ITBJlbyMSV6z3niOySO5pgQ=="
|
||||
},
|
||||
"@types/figures": {
|
||||
"version": "3.0.1",
|
||||
@@ -2324,9 +2337,9 @@
|
||||
"integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA=="
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "14.11.5",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-14.11.5.tgz",
|
||||
"integrity": "sha512-jVFzDV6NTbrLMxm4xDSIW/gKnk8rQLF9wAzLWIOg+5nU6ACrIMndeBdXci0FGtqJbP9tQvm6V39eshc96TO2wQ=="
|
||||
"version": "14.14.14",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-14.14.14.tgz",
|
||||
"integrity": "sha512-UHnOPWVWV1z+VV8k6L1HhG7UbGBgIdghqF3l9Ny9ApPghbjICXkUJSd/b9gOgQfjM1r+37cipdw/HJ3F6ICEnQ=="
|
||||
},
|
||||
"@types/parcel-bundler": {
|
||||
"version": "1.12.1",
|
||||
@@ -3083,9 +3096,9 @@
|
||||
}
|
||||
},
|
||||
"broadcast-channel": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://verdaccio.lossless.one/broadcast-channel/-/broadcast-channel-3.2.0.tgz",
|
||||
"integrity": "sha512-LaFTMPcULFJ84ROED6TNaKmp4pnJohPbuQ8RmQ2plB7U4YgVkHdl58cgP6bK+zUYo5EIydACMH6JalA2nac/3g==",
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://verdaccio.lossless.one/broadcast-channel/-/broadcast-channel-3.3.0.tgz",
|
||||
"integrity": "sha512-mi0xKJxdHHMb/PqIGLybPlAHMqs/ShxXSylaVYVM20ViizXEbjaXAy9Q6YalUGX5FoAls0UBNaT8mX8LR259bA==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.7.2",
|
||||
"detect-node": "^2.0.4",
|
||||
@@ -3251,8 +3264,7 @@
|
||||
"buffer-json": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://verdaccio.lossless.one/buffer-json/-/buffer-json-2.0.0.tgz",
|
||||
"integrity": "sha512-+jjPFVqyfF1esi9fvfUs3NqM0pH1ziZ36VP4hmA/y/Ssfo/5w5xHKfTw9BwQjoJ1w/oVtpLomqwUHKdefGyuHw==",
|
||||
"dev": true
|
||||
"integrity": "sha512-+jjPFVqyfF1esi9fvfUs3NqM0pH1ziZ36VP4hmA/y/Ssfo/5w5xHKfTw9BwQjoJ1w/oVtpLomqwUHKdefGyuHw=="
|
||||
},
|
||||
"buffer-xor": {
|
||||
"version": "1.0.3",
|
||||
@@ -5247,8 +5259,7 @@
|
||||
"fast-json-stable-stringify": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://verdaccio.lossless.one/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
|
||||
"integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==",
|
||||
"dev": true
|
||||
"integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw=="
|
||||
},
|
||||
"fast-levenshtein": {
|
||||
"version": "2.0.6",
|
||||
@@ -7283,8 +7294,7 @@
|
||||
"lodash.clonedeep": {
|
||||
"version": "4.5.0",
|
||||
"resolved": "https://verdaccio.lossless.one/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz",
|
||||
"integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=",
|
||||
"dev": true
|
||||
"integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8="
|
||||
},
|
||||
"lodash.isarguments": {
|
||||
"version": "3.1.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@designestate/dees-comms",
|
||||
"version": "1.0.7",
|
||||
"version": "1.0.9",
|
||||
"private": false,
|
||||
"description": "a comms module for communicating within the DOM",
|
||||
"main": "dist_ts/index.js",
|
||||
@@ -16,14 +16,14 @@
|
||||
"@gitzone/tsbundle": "^1.0.78",
|
||||
"@gitzone/tstest": "^1.0.52",
|
||||
"@pushrocks/tapbundle": "^3.2.9",
|
||||
"@types/node": "^14.11.5",
|
||||
"@types/node": "^14.14.14",
|
||||
"tslint": "^6.1.3",
|
||||
"tslint-config-prettier": "^1.15.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@apiglobal/typedrequest": "^1.0.53",
|
||||
"@apiglobal/typedrequest": "^1.0.56",
|
||||
"@apiglobal/typedrequest-interfaces": "^1.0.15",
|
||||
"broadcast-channel": "^3.2.0"
|
||||
"broadcast-channel": "^3.3.0"
|
||||
},
|
||||
"files": [
|
||||
"ts/**/*",
|
||||
|
||||
@@ -6,13 +6,13 @@ let deesCommsTest: deesComms.DeesComms;
|
||||
tap.test('first test', async (tools) => {
|
||||
deesCommsTest = new deesComms.DeesComms();
|
||||
deesCommsTest.createTypedHandler<any>('test', async (requestData) => {
|
||||
return {'hitheretoo': 'greetings'};
|
||||
return { hitheretoo: `greetings to ${requestData.hithere}` };
|
||||
});
|
||||
|
||||
// lets fire a request
|
||||
const typedrequest = deesCommsTest.createTypedRequest<any>('test');
|
||||
const result = await typedrequest.fire({
|
||||
'hithere': 'hello'
|
||||
hithere: 'hello',
|
||||
});
|
||||
console.log(JSON.stringify(result));
|
||||
});
|
||||
|
||||
@@ -13,6 +13,12 @@ export class DeesComms {
|
||||
// sending messages
|
||||
private postChannel = new BroadcastChannel('dees-comms');
|
||||
public typedrouter = new plugins.typedrequest.TypedRouter();
|
||||
public typedtarget = new plugins.typedrequest.TypedTarget({
|
||||
postMethodWithTypedRouter: async (messageArg) => {
|
||||
this.postMessage(messageArg);
|
||||
},
|
||||
typedRouterRef: this.typedrouter,
|
||||
});
|
||||
|
||||
private subscriptionChannel = new BroadcastChannel('dees-comms');
|
||||
|
||||
@@ -33,13 +39,7 @@ export class DeesComms {
|
||||
public createTypedRequest<T extends plugins.typedrequestInterfaces.ITypedRequest>(
|
||||
methodName: T['method']
|
||||
): TypedRequest<T> {
|
||||
const typedrequest = new plugins.typedrequest.TypedRequest(
|
||||
async (messageArg) => {
|
||||
this.postMessage(messageArg);
|
||||
},
|
||||
methodName,
|
||||
this.typedrouter
|
||||
);
|
||||
const typedrequest = new plugins.typedrequest.TypedRequest(this.typedtarget, methodName);
|
||||
return typedrequest;
|
||||
}
|
||||
|
||||
@@ -59,6 +59,8 @@ export class DeesComms {
|
||||
methodArg: T['method'],
|
||||
handlerFunction: plugins.typedrequest.THandlerFunction<T>
|
||||
) {
|
||||
this.typedrouter.addTypedHandler(new plugins.typedrequest.TypedHandler<T>(methodArg, handlerFunction));
|
||||
this.typedrouter.addTypedHandler(
|
||||
new plugins.typedrequest.TypedHandler<T>(methodArg, handlerFunction)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,4 @@ export { typedrequestInterfaces, typedrequest };
|
||||
// thirdparty scope
|
||||
import { BroadcastChannel as BroadCastChannelPolyfill } from 'broadcast-channel';
|
||||
|
||||
export {
|
||||
BroadCastChannelPolyfill
|
||||
};
|
||||
export { BroadCastChannelPolyfill };
|
||||
|
||||
@@ -1 +1 @@
|
||||
export * from './dees-comms.classes.deescomms';
|
||||
export * from './dees-comms.classes.deescomms';
|
||||
|
||||
Reference in New Issue
Block a user