mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-05 06:28:51 +00:00
my mistake lol
This commit is contained in:
1 parent
f7b8517155
commit
79c29c3f7e
4 files changed
+12
-15
No files matched your search
@@ -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]);
|
||||
};
|
||||
};
|
||||
Reference in new issue
Block a user