mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
feat(phone/hooks): implemented clipboard
This commit is contained in:
1 parent
e13b064d73
commit
550eb8f38f
6 files changed
+51
-34
No files matched your search
@@ -1,12 +1,12 @@
|
||||
import { atom } from "recoil";
|
||||
import { atom } from 'recoil';
|
||||
|
||||
export const phoneState = {
|
||||
visibility: atom({
|
||||
key: "phoneVisibility",
|
||||
key: 'phoneVisibility',
|
||||
default: false,
|
||||
}),
|
||||
phoneConfig: atom({
|
||||
key: "phoneConfig",
|
||||
key: 'phoneConfig',
|
||||
default: undefined,
|
||||
}),
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
export const setClipboard = (value: string) => {
|
||||
const clipElem = document.createElement('input');
|
||||
clipElem.value = value;
|
||||
document.body.appendChild(clipElem);
|
||||
clipElem.select();
|
||||
document.execCommand('copy');
|
||||
document.body.removeChild(clipElem);
|
||||
};
|
||||
@@ -1,12 +1,12 @@
|
||||
import { useSetRecoilState } from "recoil";
|
||||
import { phoneState } from "./state";
|
||||
import { useNuiEvent } from "../../nui-events/hooks/useNuiEvent";
|
||||
import { usePhone } from "./usePhone";
|
||||
import { useSetRecoilState } from 'recoil';
|
||||
import { phoneState } from './state';
|
||||
import { useNuiEvent } from '../../nui-events/hooks/useNuiEvent';
|
||||
import { usePhone } from './usePhone';
|
||||
|
||||
export const usePhoneService = () => {
|
||||
const setVisibility = useSetRecoilState(phoneState.visibility);
|
||||
const setPhoneConfig = useSetRecoilState(phoneState.phoneConfig);
|
||||
useNuiEvent("PHONE", "setVisibility", setVisibility);
|
||||
useNuiEvent("PHONE", "phoneConfig", setPhoneConfig);
|
||||
useNuiEvent('PHONE', 'setVisibility', setVisibility);
|
||||
useNuiEvent('PHONE', 'phoneConfig', setPhoneConfig);
|
||||
return usePhone();
|
||||
};
|
||||
Reference in new issue
Block a user