Skip to content

feat(modules/createJob): triggerevent for created jobs#1615

Merged
Kenshiin13 merged 1 commit into
esx-framework:devfrom
t1ger-scripts:dev
Feb 18, 2025
Merged

feat(modules/createJob): triggerevent for created jobs#1615
Kenshiin13 merged 1 commit into
esx-framework:devfrom
t1ger-scripts:dev

Conversation

@t1ger-scripts

Copy link
Copy Markdown
Contributor

Added a TriggerEvent when a job is created successfully, allowing developers to use an event listener and update ESX.Jobs, instead of importing the whole ESX object.

Description

Adds a TriggerEvent "esx:jobCreated" with job name (string) and job data (table), to allow allow developers to update/sync ESX.Jobs, using an event listener, without importing the ESX object.


Motivation

Allowing developers to easily update ESX.Jobs in their script with an event listener, instead of important the whole ESX object to sync the newly created job(s).


Implementation Details

The event has job name and job data as parameters, so instead of replacing the whole ESX.Jobs, you only add the relevant updates.


Usage Example

RegisterNetEvent("esx:jobCreated", function(jobName, jobData)
    if not jobName or type(jobName) ~= 'string' then
        return 
    end
    if not jobData or type(jobData) ~= 'table' then 
        return 
    end
    ESX.Jobs[jobName] = jobData
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.

Added a TriggerEvent when a job is created successfully, allowing developers to use an event listener and update ESX.Jobs, instead of importing the whole ESX object.

@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 380e659 into esx-framework:dev Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready for Next Update

Development

Successfully merging this pull request may close these issues.

2 participants