fix(scripts/nui-callbacks): Fixed NUI callback stalls

This commit is contained in:
Taso committed 2021-02-09 18:43:54 -05:00
1 parent 6b21cfddd0
commit 47e1f2950e
5 files changed
+45 -28

No files matched your search

+9 -8
View File
@@ -11,11 +11,12 @@ onNet(events.CONTACTS_SEND_CONTACTS, (contacts: any) => {
});
RegisterNuiCallbackType(events.CONTACTS_ADD_CONTACT);
on(`__cfx_nui:${events.CONTACTS_ADD_CONTACT}`, (data: any) => {
on(`__cfx_nui:${events.CONTACTS_ADD_CONTACT}`, (data: any, cb: Function) => {
const display = data.name;
const number = data.number;
const avatar = data.avatar;
emitNet(events.CONTACTS_ADD_CONTACT, number, display, avatar);
cb();
});
onNet(events.CONTACTS_ADD_CONTACT_SUCCESS, () => {
@@ -23,20 +24,20 @@ onNet(events.CONTACTS_ADD_CONTACT_SUCCESS, () => {
});
RegisterNuiCallbackType(events.CONTACTS_UPDATE_CONTACT);
on(`__cfx_nui:${events.CONTACTS_UPDATE_CONTACT}`, (data: any) => {
const contact = data;
emitNet(events.CONTACTS_UPDATE_CONTACT, contact);
on(`__cfx_nui:${events.CONTACTS_UPDATE_CONTACT}`, (data: any, cb: Function) => {
emitNet(events.CONTACTS_UPDATE_CONTACT, data);
cb();
});
onNet(events.CONTACTS_UPDATE_CONTACT_SUCCESS, () => {
emitNet(events.CONTACTS_GET_CONTACTS);
console.log("did you update the contact??????????????????");
console.log('did you update the contact??????????????????');
});
RegisterNuiCallbackType(events.CONTACTS_DELETE_CONTACT);
on(`__cfx_nui:${events.CONTACTS_DELETE_CONTACT}`, (data: any) => {
const contact = data;
emitNet(events.CONTACTS_DELETE_CONTACT, contact);
on(`__cfx_nui:${events.CONTACTS_DELETE_CONTACT}`, (data: any, cb: Function) => {
emitNet(events.CONTACTS_DELETE_CONTACT, data);
cb();
});
onNet(events.CONTACTS_DELETE_CONTACT_SUCCESS, () => {