Skip to content

Commit 8c5a7fe

Browse files
committed
Adds useeventHandler hook and upgrades NodeGui
1 parent 35f7cac commit 8c5a7fe

File tree

6 files changed

+25
-7
lines changed

6 files changed

+25
-7
lines changed

.npmignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
examples

package-lock.json

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nodegui/react-desktop",
3-
"version": "0.0.6",
3+
"version": "0.0.7",
44
"description": "React Native for building cross platform desktop applications",
55
"main": "dist/src/index.js",
66
"files": [
@@ -27,7 +27,7 @@
2727
"react": "*"
2828
},
2929
"devDependencies": {
30-
"@nodegui/nodegui": "0.0.10",
30+
"@nodegui/nodegui": "0.0.12",
3131
"@types/node": "^12.0.10",
3232
"@types/react-reconciler": "^0.18.0",
3333
"@types/scheduler": "^0.12.1",

src/hooks/index.ts

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { useMemo, DependencyList } from "react";
2+
3+
type EventHandlerMap = {
4+
[key: string]: (...args: any[]) => void;
5+
};
6+
7+
export const useEventHandler = (
8+
eventHandlerMap: EventHandlerMap,
9+
deps: DependencyList
10+
) => {
11+
const handler = useMemo(() => {
12+
return eventHandlerMap;
13+
}, deps);
14+
return handler;
15+
};

src/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ export { ProgressBar } from "./components/ProgressBar";
88
export { RadioButton } from "./components/RadioButton";
99
export { Image } from "./components/Image";
1010
export { Window } from "./components/Window";
11+
export { useEventHandler } from "./hooks";

tsconfig.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,6 @@
6060
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
6161
"resolveJsonModule": true
6262
},
63-
"include": ["."]
63+
"include": ["."],
64+
"exclude": ["examples", "dist"]
6465
}

0 commit comments

Comments
 (0)