my mistake lol

This commit is contained in:
chip committed 2020-11-11 14:33:48 +01:00
1 parent f7b8517155
commit 79c29c3f7e
4 files changed
+12 -15

No files matched your search

+4 -3
View File
@@ -1,3 +1,4 @@
import { useEffect, useRef } from "react";
import { eventNameFactory } from "../utils/nuiUtils";
@@ -7,7 +8,7 @@ interface IOptions {
once?: boolean;
}
export const useNuiEvent = (app, method, handler, options: IOptions = {}) => {
export const useNuiEvent = (app: any, method: any, handler: any, options: IOptions = {}) => {
const savedHandler: any = useRef();
const { capture, passive, once } = options;
@@ -17,7 +18,7 @@ export const useNuiEvent = (app, method, handler, options: IOptions = {}) => {
useEffect(() => {
const eventName = eventNameFactory(app, method);
const eventListener = (event) => {
const eventListener = (event: any ) => {
if (savedHandler.current && savedHandler.current.call) {
const { data } = event;
console.log(eventName, data);
@@ -28,4 +29,4 @@ export const useNuiEvent = (app, method, handler, options: IOptions = {}) => {
window.addEventListener(eventName, eventListener, opts);
return () => window.removeEventListener(eventName, eventListener, opts);
}, [app, method, capture, passive, once]);
};
};