[SOLVED] Listening to an event without an initialize function

Hi!

I work on authentication / registration in my game using a third-party service. This service provides a library with API methods. I have a form in which the user enters their data. I do a form validation and I want to pass in user data, which are taken as parameters of one of the API methods, using an event. However, I am unable to raise an event, because the API method is called not in the scope of the initialize function.

Question. Can I listen to events without the initialize function provided by playcanvas?

Can you rephrase? I don’t quite follow. An example would really help too.

How are you raising the event?
What needs to be listening to it?
Is this an order of execution issue?

Thanks for the offer to help, but I have already solved the problem. :slightly_smiling_face:
In short, I needed to access the app object without the initialize function, in the global scope. I did it like this:

var app = pc.Application.getApplication();

app.on('eventName', function() {
    console.log('eventName');
});