styling: Enforced styling across all files (#55)

This commit is contained in:
Taso authored and GitHub committed 2021-01-12 21:31:03 -05:00
1 parent c9b3174505
commit 54daa42454
165 files changed
+1879 -1725

No files matched your search

+10 -6
View File
@@ -1,6 +1,5 @@
import { useEffect, useRef } from "react";
import { eventNameFactory } from "../utils/nuiUtils";
import { useEffect, useRef } from 'react';
import { eventNameFactory } from '../utils/nuiUtils';
interface IOptions {
capture?: boolean;
@@ -8,7 +7,12 @@ interface IOptions {
once?: boolean;
}
export const useNuiEvent = (app: any, method: any, handler: any, options: IOptions = {}) => {
export const useNuiEvent = (
app: any,
method: any,
handler: any,
options: IOptions = {}
) => {
const savedHandler: any = useRef();
const { capture, passive, once } = options;
@@ -18,7 +22,7 @@ export const useNuiEvent = (app: any, method: any, handler: any, options: IOptio
useEffect(() => {
const eventName = eventNameFactory(app, method);
const eventListener = (event: any ) => {
const eventListener = (event: any) => {
if (savedHandler.current && savedHandler.current.call) {
const { data } = event;
console.log(eventName, data);
@@ -29,4 +33,4 @@ export const useNuiEvent = (app: any, method: any, handler: any, options: IOptio
window.addEventListener(eventName, eventListener, opts);
return () => window.removeEventListener(eventName, eventListener, opts);
}, [app, method, capture, passive, once]);
};
};
@@ -1,5 +1,5 @@
import { useEffect } from "react";
import { eventNameFactory } from "../utils/nuiUtils";
import { useEffect } from 'react';
import { eventNameFactory } from '../utils/nuiUtils';
interface IOptions {
capture?: boolean;
@@ -21,7 +21,7 @@ export const useNuiService = (options: IOptions = {}) => {
};
useEffect(() => {
const opts = { capture, passive, once };
window.addEventListener("message", eventListener, opts);
return () => window.removeEventListener("message", eventListener, opts);
window.addEventListener('message', eventListener, opts);
return () => window.removeEventListener('message', eventListener, opts);
}, [capture, passive, once]);
};
};
+2 -2
View File
@@ -3,9 +3,9 @@ export default {
async send(event: any, data = {}) {
/* eslint-disable no-unreachable */
return fetch(`http://new-phone-who-dis/${event}`, {
method: "post",
method: 'post',
headers: {
"Content-Type": "application/json; charset=UTF-8",
'Content-Type': 'application/json; charset=UTF-8',
},
body: JSON.stringify(data),
});
+1 -1
View File
@@ -1,2 +1,2 @@
export const eventNameFactory = (app: any, method: any) => `${app}:${method}`;
export const eventNameMethod = (name: any) => name.split(":")[1] || null;
export const eventNameMethod = (name: any) => name.split(':')[1] || null;