@jay-framework/4-react 0.17.0 → 0.17.2
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/dist/index.js +10 -6
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -112,18 +112,22 @@ function jay2React(comp) {
|
|
|
112
112
|
return (reactProps) => {
|
|
113
113
|
const [props, events] = splitPropsEvents(reactProps);
|
|
114
114
|
const myInstanceRef = useRef(null);
|
|
115
|
+
const eventHandlersRef = useRef({});
|
|
115
116
|
if (!myInstanceRef.current) {
|
|
116
117
|
myInstanceRef.current = comp()(props);
|
|
117
118
|
} else {
|
|
118
119
|
const reactViewStateState = useState(null);
|
|
119
120
|
myInstanceRef.current.update({ ...props, reactViewStateState });
|
|
120
121
|
}
|
|
121
|
-
Object.keys(events).forEach(
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
122
|
+
Object.keys(events).forEach((eventName) => {
|
|
123
|
+
const eventType = eventName.substring(2);
|
|
124
|
+
const prev = eventHandlersRef.current[eventType];
|
|
125
|
+
if (prev)
|
|
126
|
+
myInstanceRef.current.removeEventListener(eventType, prev);
|
|
127
|
+
const handler = ({ event }) => events[eventName](event);
|
|
128
|
+
eventHandlersRef.current[eventType] = handler;
|
|
129
|
+
myInstanceRef.current.addEventListener(eventType, handler);
|
|
130
|
+
});
|
|
127
131
|
return myInstanceRef.current.element["react"];
|
|
128
132
|
};
|
|
129
133
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jay-framework/4-react",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -20,18 +20,18 @@
|
|
|
20
20
|
"test:watch": "vitest"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@jay-framework/component": "^0.17.
|
|
24
|
-
"@jay-framework/json-patch": "^0.17.
|
|
25
|
-
"@jay-framework/reactive": "^0.17.
|
|
26
|
-
"@jay-framework/runtime": "^0.17.
|
|
27
|
-
"@jay-framework/secure": "^0.17.
|
|
28
|
-
"@jay-framework/serialization": "^0.17.
|
|
23
|
+
"@jay-framework/component": "^0.17.2",
|
|
24
|
+
"@jay-framework/json-patch": "^0.17.2",
|
|
25
|
+
"@jay-framework/reactive": "^0.17.2",
|
|
26
|
+
"@jay-framework/runtime": "^0.17.2",
|
|
27
|
+
"@jay-framework/secure": "^0.17.2",
|
|
28
|
+
"@jay-framework/serialization": "^0.17.2",
|
|
29
29
|
"@testing-library/dom": "^10.4.0",
|
|
30
30
|
"react": "^18.2.0",
|
|
31
31
|
"react-dom": "^18.2.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@jay-framework/dev-environment": "^0.17.
|
|
34
|
+
"@jay-framework/dev-environment": "^0.17.2",
|
|
35
35
|
"@testing-library/jest-dom": "^6.4.2",
|
|
36
36
|
"@testing-library/react": "^14.2.2",
|
|
37
37
|
"@testing-library/user-event": "^14.5.2",
|