Search code examples
javascriptionic-frameworkwebstorm

WebStorm debugging and subsequent clicks


I have a back button in my Ionic Framework application, and it's moving too quickly due to Ionic's removal of the browser lag that usually accompanies browsers inputs.

This leads my app to allow really fast clicking of buttons, and causing strange behaviors.

If I land a break point, I cannot debug properly because the first click gets 'caught' by the breakpoint. I want to write a timeout that fixes this problem but it's hard to debug/test. Ideas?


Solution

  • Webstorm seems to support conditional breakpoints, so you could introduce something like a counter into your code:

     var i = 0;
    
     theButton.click(function()
     {
         i++;
    
         // Your code here, put a conditional breakpoint in, such as 
         // mod 5'ing i so you can see the program state every 5th click
         // for example.
     }
    

    Bit of a hacky approach, but it might give you what you need.