refactor: enable JS exports for more recent artifacts

We still don't have a bump in recommended artifact, so for now check for the existence of new(ish) native.
This commit is contained in:
Linden committed 2021-12-01 02:51:05 +11:00
1 parent 3e266ec952
commit dbe107e669
3 files changed
+6 -2

No files matched your search

+4
View File
@@ -28,6 +28,9 @@ CreateThread(function()
end, 'GET') end, 'GET')
end) end)
-- Check for a recent native since the recommended artifact doesn't support JS async_retval or dependency constraints
if not GetEntityAttachedTo then
---@param query string ---@param query string
---@param parameters? table ---@param parameters? table
---@return integer result ---@return integer result
@@ -125,3 +128,4 @@ exports('prepareSync', function(query, parameters)
end, GetInvokingResource()) end, GetInvokingResource())
return Citizen.Await(p) return Citizen.Await(p)
end) end)
end
+1 -1
View File
@@ -16,6 +16,6 @@ const isolationLevel = (() => {
} }
})(); })();
const resourceName = GetCurrentResourceName() || 'oxmysql'; const resourceName = GetCurrentResourceName();
export { slowQueryWarning, debug, isolationLevel, resourceName }; export { slowQueryWarning, debug, isolationLevel, resourceName };
+1 -1
View File
@@ -60,7 +60,7 @@ global.exports('prepare', (query, parameters, cb, resource = GetInvokingResource
safeCallback(cb || parameters, result, resource, query)) safeCallback(cb || parameters, result, resource, query))
}); });
if (!GetResourceMetadata(GetCurrentResourceName(), 'server_script', 1)) { if (GetEntityAttachedTo || !GetResourceMetadata(GetCurrentResourceName(), 'server_script', 1)) {
global.exports('prepareSync', async (query, parameters) => { global.exports('prepareSync', async (query, parameters) => {
const result = await preparedStatement(query, parameters, GetInvokingResource()); const result = await preparedStatement(query, parameters, GetInvokingResource());
return result; return result;