20 Commits

Author SHA1 Message Date
97eba85337 1.0.16 2022-01-28 17:59:07 +01:00
61936bbdd1 fix(core): update 2022-01-28 17:59:06 +01:00
4ab1b917a9 1.0.15 2022-01-28 17:40:12 +01:00
f299cff4c9 fix(core): update 2022-01-28 17:40:12 +01:00
a6e262bbae 1.0.14 2022-01-24 05:13:21 +01:00
8a8200ca8a fix(core): update 2022-01-24 05:13:19 +01:00
e7785cc31b 1.0.13 2022-01-24 05:11:56 +01:00
63610b66bc fix(core): update 2022-01-24 05:11:55 +01:00
d8d382b2fb 1.0.12 2022-01-24 04:52:41 +01:00
7c8a2eeaeb fix(core): update 2022-01-24 04:52:39 +01:00
a34e8f571d 1.0.11 2021-09-27 13:51:00 +02:00
2bf398cf97 fix(core): update 2021-09-27 13:50:59 +02:00
315bbffac2 1.0.10 2021-09-27 12:27:21 +02:00
52e77d1c3e fix(core): update 2021-09-27 12:27:20 +02:00
9ac1fdbb63 1.0.9 2020-12-21 12:07:35 +00:00
ac43f63daf fix(core): update 2020-12-21 12:07:34 +00:00
c8ce7942d5 1.0.8 2020-12-21 12:07:18 +00:00
336351b98a fix(core): update 2020-12-21 12:07:18 +00:00
20dcc9dc00 1.0.7 2020-10-07 13:01:11 +00:00
f273094369 fix(core): update 2020-10-07 13:01:09 +00:00
7 changed files with 19760 additions and 3878 deletions

View File

@@ -36,6 +36,7 @@ auditProductionDependencies:
- npmci command npm audit --audit-level=high --only=prod --production - npmci command npm audit --audit-level=high --only=prod --production
tags: tags:
- docker - docker
allow_failure: true
auditDevDependencies: auditDevDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci image: registry.gitlab.com/hosttoday/ht-docker-node:npmci

23582
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{ {
"name": "@designestate/dees-comms", "name": "@designestate/dees-comms",
"version": "1.0.6", "version": "1.0.16",
"private": false, "private": false,
"description": "a comms module for communicating within the DOM", "description": "a comms module for communicating within the DOM",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",
@@ -9,20 +9,21 @@
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"test": "(tstest test/ --web)", "test": "(tstest test/ --web)",
"build": "(tsbuild --web)" "build": "(tsbuild --web && tsbundle npm)"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.25", "@gitzone/tsbuild": "^2.1.29",
"@gitzone/tsbundle": "^1.0.78", "@gitzone/tsbundle": "^1.0.89",
"@gitzone/tstest": "^1.0.52", "@gitzone/tstest": "^1.0.60",
"@pushrocks/tapbundle": "^3.2.9", "@pushrocks/tapbundle": "^4.0.0",
"@types/node": "^14.11.5", "@types/node": "^17.0.10",
"tslint": "^6.1.3", "tslint": "^6.1.3",
"tslint-config-prettier": "^1.15.0" "tslint-config-prettier": "^1.15.0"
}, },
"dependencies": { "dependencies": {
"@apiglobal/typedrequest": "^1.0.53", "@apiglobal/typedrequest": "^1.0.65",
"@apiglobal/typedrequest-interfaces": "^1.0.15" "@apiglobal/typedrequest-interfaces": "^1.0.15",
"broadcast-channel": "^3.7.0"
}, },
"files": [ "files": [
"ts/**/*", "ts/**/*",

View File

@@ -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'}; 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));
}); });

View File

@@ -1,6 +1,11 @@
import { TypedRequest } from '@apiglobal/typedrequest'; import { TypedRequest } from '@apiglobal/typedrequest';
import * as plugins from './dees-comms.plugins'; import * as plugins from './dees-comms.plugins';
let BroadcastChannel = globalThis.BroadcastChannel;
if (!BroadcastChannel) {
BroadcastChannel = plugins.BroadCastChannelPolyfill as any;
}
/** /**
* a comm class for client side communication between workers and tabs. * a comm class for client side communication between workers and tabs.
*/ */
@@ -8,6 +13,12 @@ export class DeesComms {
// sending messages // sending messages
private postChannel = new BroadcastChannel('dees-comms'); private postChannel = new BroadcastChannel('dees-comms');
public typedrouter = new plugins.typedrequest.TypedRouter(); 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'); private subscriptionChannel = new BroadcastChannel('dees-comms');
@@ -28,13 +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);
async (messageArg) => {
this.postMessage(messageArg);
},
methodName,
this.typedrouter
);
return typedrequest; return typedrequest;
} }
@@ -54,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)
);
} }
} }

View File

@@ -3,3 +3,10 @@ import * as typedrequestInterfaces from '@apiglobal/typedrequest-interfaces';
import * as typedrequest from '@apiglobal/typedrequest'; import * as typedrequest from '@apiglobal/typedrequest';
export { typedrequestInterfaces, typedrequest }; export { typedrequestInterfaces, typedrequest };
// third party scope
import { BroadcastChannel as BroadCastChannelPolyfill } from 'broadcast-channel';
export {
BroadCastChannelPolyfill
}