hermes-io 2.2.3 → 2.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/context.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
let isDevtoolsInitialized = false;
|
|
2
1
|
let recording = false;
|
|
3
2
|
let collection = [];
|
|
4
3
|
|
|
@@ -26,13 +25,7 @@ const handleMessageFromDevtools = (event) => {
|
|
|
26
25
|
};
|
|
27
26
|
|
|
28
27
|
|
|
29
|
-
|
|
30
|
-
if (!isDevtoolsInitialized) {
|
|
31
|
-
window.addEventListener("message", handleMessageFromDevtools);
|
|
32
|
-
isDevtoolsInitialized = true;
|
|
33
|
-
}
|
|
34
|
-
return isDevtoolsInitialized;
|
|
35
|
-
};
|
|
28
|
+
window.addEventListener("message", handleMessageFromDevtools);
|
|
36
29
|
|
|
37
30
|
export class Context {
|
|
38
31
|
id = null;
|
|
@@ -20,10 +20,15 @@ const Products = (props = {}) => {
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
const handleRemoveProduct = (product = {}) => {
|
|
23
|
+
console.log(1, product);
|
|
24
|
+
console.log(2, product);
|
|
25
|
+
console.log(3, product);
|
|
23
26
|
ProductsObserver.remove.notify({
|
|
24
27
|
value: product,
|
|
25
28
|
context: contexts.products,
|
|
26
29
|
});
|
|
30
|
+
console.log(4, product);
|
|
31
|
+
console.log(5, product);
|
|
27
32
|
};
|
|
28
33
|
|
|
29
34
|
return (
|
package/hooks/useObserver.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { useEffect } from "react";
|
|
2
|
-
import { enableDevTools } from "../context";
|
|
3
2
|
|
|
4
3
|
export const useObserver = (props = {}) => {
|
|
5
4
|
useEffect(() => {
|
|
@@ -8,9 +7,7 @@ export const useObserver = (props = {}) => {
|
|
|
8
7
|
const hasfromList = contexts.length !== 0;
|
|
9
8
|
const hasValidList = hasfromList && contexts.find((ctx) => ctx.id === payload?.context?.id);
|
|
10
9
|
if (hasValidList) {
|
|
11
|
-
|
|
12
|
-
payload?.context?.update({ value: payload, listener });
|
|
13
|
-
}
|
|
10
|
+
payload?.context?.update({ value: payload, listener });
|
|
14
11
|
listener?.(payload, resolve);
|
|
15
12
|
}
|
|
16
13
|
}
|
package/package.json
CHANGED