Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Suggestion] Better UI to Client Sync #552

Open
xKenji-TC opened this issue Apr 22, 2024 · 0 comments
Open

[Suggestion] Better UI to Client Sync #552

xKenji-TC opened this issue Apr 22, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@xKenji-TC
Copy link

xKenji-TC commented Apr 22, 2024

I've been having a problem after I hide my menu and check if it is open, it's having and a delay and making it bug whenever I try to show the menu right after I hide it.
I think it will be better synced with this script below

Replace this

function lib.hideMenu(onExit)
    local menu = openMenu
    openMenu = nil

    if not menu then return end

    lib.resetNuiFocus()

    if onExit and menu.onClose then
        menu.onClose()
    end

    SendNUIMessage({
        action = 'closeMenu'
    })
end

With this:

local ExitFunction, closing = false, false
function lib.hideMenu(onExit)
    if closing or not openMenu then return end
    closing = true
    ExitFunction = onExit
    SendNUIMessage({
        action = 'closeMenu'
    })
end
RegisterNUICallback('closed', function()
    if not openMenu then return end
    local menu = openMenu
    openMenu = nil
    closing = false
    lib.resetNuiFocus()
    if ExitFunction then
        menu.onClose()
    end
    ExitFunction = false
end)

And add something on js to trigger that callback after the menu is closed

@xKenji-TC xKenji-TC added the enhancement New feature or request label Apr 22, 2024
@xKenji-TC xKenji-TC changed the title Better UI to Client Sync [Suggestion]Better UI to Client Sync Apr 22, 2024
@xKenji-TC xKenji-TC changed the title [Suggestion]Better UI to Client Sync [Suggestion] Better UI to Client Sync Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant