Search code examples
javascriptgoogle-chromedeveloper-tools

How to get anonymous function to be named in Chrome Timeline?


The Chrome Developer Tools Timeline shows "(anonymous function)" for all of the code that's running slow and so I can't figure out what's going on. Is there a trick to getting these named? It also won't allow me to jump to the source of these anonymous functions. I'm using ES6 w/ arrow functions and babel.

Slow


Solution

  • Don't use lambda functions in your code. Instead of:

    async(function(){});
    

    write:

    function withName(){};
    async(withName);