I have a script, that uses data from a data layer. If I fire the script too early it doesn't work because the data (I refer to in the script) is not defined yet. Therefore I delayed the script (1500ms). The problem is that the script should run as early as possible. Sometimes the data (from the data layer) is available faster, sometimes later...
so instead of delaying my script always 1500ms, I would like to run the script after 500ms and if it doesn't work because the data/property is not defined/available yet, I want to run it again after another 500 ms.... etc.
how could I action this?
thx!!