I have a javascript (jQuery) method (function) which gets me the bandwidth vie Boomerang.
The function looks this:
this.getBandwidth = function() {
var cookie = BOOMR.utils.getCookie('BA');
if (cookie !== null) {
return true;
} else {
return false;
}
};
Now it takes a while to get the Cookie and cookie being no longer null. So if cookie is actually still null, I need to start over. If I just call getBandwidth() in the else part again I get a stack overflow. Already tried to use while loop for checking 'cookie' but it blocks the browser.
How can I simply repeat the assignment until cookie is ready? Pulling my hair out!
Thanks.
You should subscribe to the before_beacon event of the BOOMR object. See docs here: http://lognormal.github.io/boomerang/doc/api/BOOMR.html
Put that somewhere after you define your
getBandwidth
function, and it will be called once boomerang has finished doing everything it needs to do.