fix(core): update
This commit is contained in:
parent
c8ce7942d5
commit
ac43f63daf
@ -6,13 +6,13 @@ 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 {'hitheretoo': `greetings to ${requestData.hithere}`};
|
return { hitheretoo: `greetings to ${requestData.hithere}` };
|
||||||
});
|
});
|
||||||
|
|
||||||
// lets fire a request
|
// lets fire a request
|
||||||
const typedrequest = deesCommsTest.createTypedRequest<any>('test');
|
const typedrequest = deesCommsTest.createTypedRequest<any>('test');
|
||||||
const result = await typedrequest.fire({
|
const result = await typedrequest.fire({
|
||||||
'hithere': 'hello'
|
hithere: 'hello',
|
||||||
});
|
});
|
||||||
console.log(JSON.stringify(result));
|
console.log(JSON.stringify(result));
|
||||||
});
|
});
|
||||||
|
@ -17,8 +17,8 @@ export class DeesComms {
|
|||||||
postMethodWithTypedRouter: async (messageArg) => {
|
postMethodWithTypedRouter: async (messageArg) => {
|
||||||
this.postMessage(messageArg);
|
this.postMessage(messageArg);
|
||||||
},
|
},
|
||||||
typedRouterRef: this.typedrouter
|
typedRouterRef: this.typedrouter,
|
||||||
})
|
});
|
||||||
|
|
||||||
private subscriptionChannel = new BroadcastChannel('dees-comms');
|
private subscriptionChannel = new BroadcastChannel('dees-comms');
|
||||||
|
|
||||||
@ -39,10 +39,7 @@ export class DeesComms {
|
|||||||
public createTypedRequest<T extends plugins.typedrequestInterfaces.ITypedRequest>(
|
public createTypedRequest<T extends plugins.typedrequestInterfaces.ITypedRequest>(
|
||||||
methodName: T['method']
|
methodName: T['method']
|
||||||
): TypedRequest<T> {
|
): TypedRequest<T> {
|
||||||
const typedrequest = new plugins.typedrequest.TypedRequest(
|
const typedrequest = new plugins.typedrequest.TypedRequest(this.typedtarget, methodName);
|
||||||
this.typedtarget,
|
|
||||||
methodName
|
|
||||||
);
|
|
||||||
return typedrequest;
|
return typedrequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,6 +59,8 @@ export class DeesComms {
|
|||||||
methodArg: T['method'],
|
methodArg: T['method'],
|
||||||
handlerFunction: plugins.typedrequest.THandlerFunction<T>
|
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
|
// thirdparty scope
|
||||||
import { BroadcastChannel as BroadCastChannelPolyfill } from 'broadcast-channel';
|
import { BroadcastChannel as BroadCastChannelPolyfill } from 'broadcast-channel';
|
||||||
|
|
||||||
export {
|
export { BroadCastChannelPolyfill };
|
||||||
BroadCastChannelPolyfill
|
|
||||||
};
|
|
||||||
|
Loading…
Reference in New Issue
Block a user