Can Loadscreen use RegisterNuiCallbackType?

I’m listening for a when loadscreen finishes it’s transition effect
before removing it (via ShutdownLoadingScreenNui)

//client.js, (yes it's added as a client script in fxmanifest.lua)
RegisterNuiCallbackType("test");
on("__cfx_nui:test", (data, cb) => {
  console.log("I never get called");
  ShutdownLoadingScreenNui();
})
//loadscreen.html, when animation completes:
$.post('http://example-loadscreen/test', JSON.stringify({}));

The console log never gets called.
I assume NUI callbacks don’t work with loadscreens, right?

Nope i don’t think it’s possible. Loading screen is loading before any other script on the client as an html file only. Only thing possible is to shut it down. If im wrong i hope someone correct me on this.

You can send data using this, going back will have to be using a normal NUI-page resource instead as I don’t think a resource handler gets registered for the pseudo-loadscreen.

Hey VinaStar - I know what you are saying… the HTML does load way faster than client scripts… but rest assured the client script does eventually load (before the loadscreen completes and makes it’s callback).

Would it not hear the test callback by the time the end occurs?

Hey deterministic_bubble (I still owe you that coffee…)

Would that not be sending a message TO the loadscreen.html?

Loadscreen.html doesn’t need messages… it needs to send one… (when it’s animation completes)

(Honestly I would do without all this callback stuff if loadscreen.html’s script would understand the ShutdownLoadingScreenNui command, but it asserts the function is undefined. I assumed a client.js would need to actually call the CFX-functionality)

See second part of message.

Listen dude.
Obviously I’m struggling to get my head around the horrifyingly underdetailed documentation.
We’re all just trying to awkwardly step through this insane maze of bullshit trying to understand this platform and it’s never ending list of neuonces…

So could you not be a condesending prick on top of that?

The “second part of your message” (i.e. most of it) reads:

going back will have to be using a normal NUI-page resource instead as I don’t think a resource handler gets registered for the pseudo-loadscreen.

Makes no sense…
A “NORMAL NUI PAGE” is not a “LOADSCREEN”

Are you asserting that I can ALSO define a ui_page alongside my loadscreen? Like this?

#fxmanifest.lua
ui_page 'uipage.html'
loadscreen 'loadscreen.html'

Because what good does that do me?
I need the LOADSCREEN to communicate out.
How does the LOADSCREEN communicate out?
Not another UI_PAGE
Additionally, the DOCUMENTATION ITSELF asserts a loadscreen is just “A special NUI page”

Why is it that I wanna kill myself for even trying to ask anyone on this forum for help.

I’ve been stuck on this for hours but apparently I faILeD tO rEaD yOuR mesSaGe so I don’t qualify for helpful answers

Forget I asked this question even. Delete the topic.

I’m not trying to be offensive at all. Writing on phone, so somewhat concise.

Yes.

It’ll register the resource as able to receive NUI callbacks, which one can send from any NUI source to any resource. That also includes the pseudo-NUI frame for the load screen.

It’s probably a bug that loading screen resources don’t automatically get registered as such, not intended behavior at all.

(to clarify here)… just adding the clause for a (totally blank) ui_page in the fxmanifest.lua enables the loadscreen's messages to be heard?

Despite the UI page having no functionality?

Correct.

To substantiate this claim,

This code checks if any ui_page is defined, whereas the following code registers the NUI callback handler:

These would ideally be reordered, or called if loadscreen as well, but that’s not the case at this time.

1 Like

Well turns out that absolutely worked, thank you
(thanks also for posting code relevant to the issue)

Hours and hours of my life completely thrown down the drain again LOL (please kill me)

Bubble, give me some advice here… how can I help the next person not get stuck in this same trap?
Which obvious piece of documentation have I missed which lead me here?

(And let me offer you some; in future please don’t “see my last email” to people on forums/discussions. It doesn’t add anything to the dialogue and only serves to offend the person you are asserting didn’t read your thing)

Well im very glad that i was wrong, now i will be able to upgrade my loadingscreen :smiley: thanks!