fix(core): update

This commit is contained in:
Philipp Kunz 2020-10-06 21:49:03 +00:00
parent b26aa04388
commit ddf28a8d0e
4 changed files with 13 additions and 12 deletions

6
package-lock.json generated
View File

@ -5,9 +5,9 @@
"requires": true, "requires": true,
"dependencies": { "dependencies": {
"@apiglobal/typedrequest": { "@apiglobal/typedrequest": {
"version": "1.0.50", "version": "1.0.53",
"resolved": "https://verdaccio.lossless.one/@apiglobal%2ftypedrequest/-/typedrequest-1.0.50.tgz", "resolved": "https://verdaccio.lossless.one/@apiglobal%2ftypedrequest/-/typedrequest-1.0.53.tgz",
"integrity": "sha512-Jk4hkc6CjHf7mc1lw3RCvZEBgw1trf/kJTiXaOin3wMFLTu9JUC+GTjif/nWLmJfZJTXqpv6utL3msO+YkzRYA==", "integrity": "sha512-9KfG+ZfhryepIY1Q++OIMSU6k3Qy1MGRPXPLXQyPua5uXgHTPgT59+pczwpTAo1Mru4o0H87Xtwt596HV7FGsg==",
"requires": { "requires": {
"@apiglobal/typedrequest-interfaces": "^1.0.15", "@apiglobal/typedrequest-interfaces": "^1.0.15",
"@pushrocks/isounique": "^1.0.4", "@pushrocks/isounique": "^1.0.4",

View File

@ -21,7 +21,7 @@
"tslint-config-prettier": "^1.15.0" "tslint-config-prettier": "^1.15.0"
}, },
"dependencies": { "dependencies": {
"@apiglobal/typedrequest": "^1.0.50", "@apiglobal/typedrequest": "^1.0.53",
"@apiglobal/typedrequest-interfaces": "^1.0.15" "@apiglobal/typedrequest-interfaces": "^1.0.15"
}, },
"files": [ "files": [

View File

@ -6,17 +6,15 @@ let deesCommsTest: deesComms.DeesComms;
tap.test('first test', async (tools) => { tap.test('first test', async (tools) => {
deesCommsTest = new deesComms.DeesComms(); deesCommsTest = new deesComms.DeesComms();
deesCommsTest.createTypedHandler<any>('test', async (requestData) => { deesCommsTest.createTypedHandler<any>('test', async (requestData) => {
return {}; return {'hitheretoo': 'greetings'};
}); });
// lets fire a request // lets fire a request
const typedrequest = deesCommsTest.createTypedRequest<any>('test'); const typedrequest = deesCommsTest.createTypedRequest<any>('test');
const resultPromise = typedrequest.fire({ const result = await typedrequest.fire({
method: 'test', 'hithere': 'hello'
request: {},
response: {}
}); });
await tools.delayFor(2000); console.log(JSON.stringify(result));
}); });
tap.start(); tap.start();

View File

@ -12,10 +12,13 @@ export class DeesComms {
private subscriptionChannel = new BroadcastChannel('dees-comms'); private subscriptionChannel = new BroadcastChannel('dees-comms');
constructor() { constructor() {
this.subscriptionChannel.onmessage = (eventArg) => { this.subscriptionChannel.onmessage = async (eventArg) => {
const message = eventArg.data; const message = eventArg.data;
console.log(JSON.stringify(message)); console.log(JSON.stringify(message));
this.typedrouter.routeAndAddResponse(message); const response = await this.typedrouter.routeAndAddResponse(message);
if (response) {
this.postMessage(response);
}
}; };
} }