Skip to content

feat(esx_core) Added ESX.JobsLoaded and esx:jobsLoaded#1688

Merged
Kenshiin13 merged 7 commits into
esx-framework:devfrom
Kr3mu:dev
Jul 31, 2025
Merged

feat(esx_core) Added ESX.JobsLoaded and esx:jobsLoaded#1688
Kenshiin13 merged 7 commits into
esx-framework:devfrom
Kr3mu:dev

Conversation

@Kr3mu

@Kr3mu Kr3mu commented Jul 28, 2025

Copy link
Copy Markdown
Member

Description

  • It adds a event "esx:jobsLoaded" and variable ESX.JobsLoaded for checking if job exists.

Motivation

  • While chatting with zykem about ESX.CreateJob we found an issue where you don't know for sure if the jobs are loaded while checking if certain job exists. The event or variable fixes that problem.

Implementation Details

  • Adds variable ESX.JobsLoaded and triggers event "esx:jobsLoaded" on ESX.RefreshJobs end.

Usage Example

AddEventHandler("esx:jobsLoaded", function()
    print("yes")
end)

Citizen.CreateThread(function()
    while not ESX.JobsLoaded do
        print("Waiting for Job Load")
        Citizen.Wait(1000)
    end

    print("Loaded Jobs")
end)

PR Checklist

  • My commit messages and PR title follow the Conventional Commits standard.
  • My changes have been tested locally and function as expected.
  • My PR does not introduce any breaking changes.
  • I have provided a clear explanation of what my PR does, including the reasoning behind the changes and any relevant context.

@Kr3mu

Kr3mu commented Jul 28, 2025

Copy link
Copy Markdown
Member Author

Also fixes some formatting issues like useless spaces.

@Zykem Zykem left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make GetJobs/DoesJobExist promise based

@Kr3mu Kr3mu requested a review from Zykem July 29, 2025 13:36
Zykem
Zykem previously requested changes Jul 29, 2025

@Zykem Zykem left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a normal boolean value to await jobs isntead of promise.

@Kr3mu Kr3mu requested a review from Zykem July 29, 2025 13:47
Comment thread [core]/es_extended/server/functions.lua Outdated
Comment thread [core]/es_extended/server/functions.lua Outdated
Comment thread [core]/es_extended/server/functions.lua Outdated
@Kr3mu Kr3mu requested a review from Kenshiin13 July 30, 2025 08:44
Kenshiin13
Kenshiin13 previously approved these changes Jul 30, 2025

@Kenshiin13 Kenshiin13 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Kr3mu Kr3mu dismissed Zykem’s stale review July 31, 2025 11:00

kenshin approved

@Kenshiin13 Kenshiin13 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@Kenshiin13 Kenshiin13 merged commit 511dee2 into esx-framework:dev Jul 31, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants