fivem-ui-api-wrapper
v1.0.1
Published
An API wrapper for UI's accessing FiveM client data
Downloads
8
Readme
FiveM UI API Wrapper
Installation
npm install fivem-ui-api-wrapper
Usage
import fivemAPI from `fivem-ui-api-wrapper`;
const fetchPlayers = fivemAPI(
// The registered api endpoint in your fivem server client-side
'resource:server:getPlayers',
// Signal if you wish to abort the request
abort: new AbortSignal(),
// Any data you want to send to the server
data: {},
)
RegisterNUICallback('api', function(request, cb)
-- Framework specific code to trigger a server callback
-- @example in QB-Core
QBCore.Functions.TriggerCallback(request.endpoint, function(response)
cb(response)
end, request.data)
end)
Patch Notes
1.0.1
- Included declaration file for typescript support