Compare commits
3 Commits
v0.0.2-dev
...
v0.0.2-dev
Author | SHA1 | Date |
---|---|---|
semantic-release-bot | 18cf0fd19c | |
Derrick Hammer | af224e742a | |
Derrick Hammer | 3a4cfd45a6 |
|
@ -1,3 +1,10 @@
|
|||
## [0.0.2-develop.5](https://git.lumeweb.com/LumeWeb/kernel-swarm/compare/v0.0.2-develop.4...v0.0.2-develop.5) (2023-07-05)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* need to loop over all protomux message args and await any promises ([3a4cfd4](https://git.lumeweb.com/LumeWeb/kernel-swarm/commit/3a4cfd45a6515fac5a4205d0c2503864efbd33bf))
|
||||
|
||||
## [0.0.2-develop.4](https://git.lumeweb.com/LumeWeb/kernel-swarm/compare/v0.0.2-develop.3...v0.0.2-develop.4) (2023-07-05)
|
||||
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "@lumeweb/kernel-swarm",
|
||||
"version": "0.0.2-develop.4",
|
||||
"version": "0.0.2-develop.5",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@lumeweb/kernel-swarm",
|
||||
"version": "0.0.2-develop.4",
|
||||
"version": "0.0.2-develop.5",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"@lumeweb/hyperswarm-web": "0.0.2-develop.7",
|
||||
|
|
|
@ -38,6 +38,6 @@
|
|||
"patch-package": "^7.0.0",
|
||||
"presetter": "*"
|
||||
},
|
||||
"version": "0.0.2-develop.4",
|
||||
"version": "0.0.2-develop.5",
|
||||
"readme": "ERROR: No README data found!"
|
||||
}
|
||||
|
|
17
src/index.ts
17
src/index.ts
|
@ -576,10 +576,17 @@ async function handleCreateProtomuxMessage(aq: ActiveQuery) {
|
|||
});
|
||||
|
||||
if (data.onmessage) {
|
||||
data.onmessage = (...args: any) => {
|
||||
data.onmessage = async (...args: any) => {
|
||||
for (let i = 0; i < args.length; i++) {
|
||||
if (isPromise(args[i])) {
|
||||
args[i] = await args[i];
|
||||
}
|
||||
}
|
||||
|
||||
args = args.filter(
|
||||
(item: any) => item?.constructor.name.toLowerCase() !== "channel",
|
||||
);
|
||||
|
||||
aq.sendUpdate({
|
||||
action: "onmessage",
|
||||
args,
|
||||
|
@ -622,3 +629,11 @@ function getSwarmToSwarmId(swarm: any) {
|
|||
}
|
||||
|
||||
function noop() {}
|
||||
|
||||
function isPromise(obj: Promise<any>) {
|
||||
return (
|
||||
!!obj &&
|
||||
(typeof obj === "object" || typeof obj === "function") &&
|
||||
typeof obj.then === "function"
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue