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

View File

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

View File

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

View File

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