mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 06:56:03 +01:00
refactor(callback/client): require source in response handler
This commit is contained in:
@@ -4,6 +4,8 @@ local cbEvent = '__ox_cb_%s'
|
|||||||
local callbackTimeout = GetConvarInt('ox:callbackTimeout', 300000)
|
local callbackTimeout = GetConvarInt('ox:callbackTimeout', 300000)
|
||||||
|
|
||||||
RegisterNetEvent(cbEvent:format(cache.resource), function(key, ...)
|
RegisterNetEvent(cbEvent:format(cache.resource), function(key, ...)
|
||||||
|
if source == '' then return end
|
||||||
|
|
||||||
local cb = pendingCallbacks[key]
|
local cb = pendingCallbacks[key]
|
||||||
|
|
||||||
if not cb then return end
|
if not cb then return end
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ const pendingCallbacks: Record<string, (...args: any[]) => void> = {};
|
|||||||
const callbackTimeout = GetConvarInt('ox:callbackTimeout', 300000);
|
const callbackTimeout = GetConvarInt('ox:callbackTimeout', 300000);
|
||||||
|
|
||||||
onNet(`__ox_cb_${cache.resource}`, (key: string, ...args: any) => {
|
onNet(`__ox_cb_${cache.resource}`, (key: string, ...args: any) => {
|
||||||
|
if (!source) return;
|
||||||
|
|
||||||
const resolve = pendingCallbacks[key];
|
const resolve = pendingCallbacks[key];
|
||||||
|
|
||||||
if (!resolve) return;
|
if (!resolve) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user