Forum Discussion

plmsteven's avatar
plmsteven
Ideator I
7 years ago
Solved

How to use toggleSpinner in javascript for a client Action?

I have a medium-long running client action and are trying to use aras.browserHelper.toggleSpinner() while the client is busy and waiting for the server method to complete. It works fine in Firefox br...
  • AngelaIp's avatar
    7 years ago

    Hi,

    I wonder if the try/finally concept is the best approach. I made a quick test and it looked to me like the toggle spinner is disabled before the Method is finished.

    Maybe a promise is a better approach? Very simple sample:

    // enable toggle spinner
    aras.browserHelper.toggleSpinner(document, true);

    var promise = new Promise(function(resolve, reject) {
    // after 2 seconds disable toggle spinner
    setTimeout(
    function(){
    alert("Done");
    aras.browserHelper.toggleSpinner(document, false);
    }, 2000);
    });