mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-30 00:01:27 +00:00
Add nui message chunking
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
local Chunks = {}
|
||||
|
||||
RegisterNUICallback('__chunk', function(data, cb)
|
||||
|
||||
Chunks[data.id] = Chunks[data.id] or ''
|
||||
Chunks[data.id] = Chunks[data.id] .. data.chunk
|
||||
|
||||
if data['end'] then
|
||||
local msg = json.decode(Chunks[data.id])
|
||||
TriggerEvent(GetCurrentResourceName() .. ':message:' .. data.__type, msg)
|
||||
Chunks[data.id] = nil
|
||||
end
|
||||
|
||||
cb('')
|
||||
|
||||
end)
|
||||
Reference in New Issue
Block a user