Preloaded JS function "is not defined"

I have a mobile app that is telling me that is cannot find my JS.

image

To be clear, it is actually working just fine in the IDE, despite the fact that the linter is giving the same error in the editor:

image

Here is the definition:

If I prefix window. to the function, it works and the linter is also happy. So in Mobile this seems to be a requirement.

Interesting! I see the same behavior. My mobile app works with both {{window.test}} and {{test}}, though the linting only shows up for {{test}}.

I'll check with the Mobile team to see if there's reason in the roasting of eggs!

...or in other words, why do Mobile Apps require window when regular Apps don't. :slight_smile:

+1

I run into exactly same behaviour

window.myFunction = function() works on Android & IDE

function myFunction() only works in IDE

I added that to the ticket—thank you!

Hey @bradlymathews and @rxunique!

Update :slight_smile: We found a bug for self-hosted Retool instances related to custom global JS. You can now refer to it on the window object, though you don't have to. :tada: The Android issue should be fixed as well.

Thank you both for your feedback here and let me know if you're still running into issues here!

1 Like