[SOLVED] Call an extension from JavaScript

Ok, lol, another JavaScript question!

How do you call an extension from JavaScript?
I have, for example, the controller extension in my project and I can use it from no-code, but I can’t seem to locate it in JavaScript.
The Java output from the no-code version uses


…but when I paste that in with my javascript I get an error - it doesn’t exist. So, I’m assuming the code generator is making special code for itself, and I can’t get access to it.
I keep thinking it should be a get function like :

.something.getExtensions( "Gamepads" ).callFunction( "One of Gamepads functions" )

…but darned if I can find it!

Thanks for any and all help!

the extensions are lazy loaded for optimization (this means the game won’t load the extension unless one of its functions is used in at least one events)

event block:

locating it you can check the global “gdjs” object

using it:

1 Like

Hey, Thanks for getting back! It works! Thank you very much! I appreciate your help!

1 Like