How to remove anonymous function in symbol browser?


#1

Hi hi,

I wonder if there are any way to remove/hide anonymous functions in symbol browser, I am using jQuery and I have a lot of events (like click, ajax, done, each, etc), so the inspector is full of them.

As you can see is not very useful this way, I am unable to find a function easily without scrolling this pane.

Is this possible?


#2

@stramin, I actually thought that they were already filtered out. @nathanr, am I wrong about that? Would this be new functionality?

@stramin, can you provide some sample code for this? I can’t get an anonymous function to show up in the code browser. I should probably go home!

  • Carey

#3

Yes, the most usual anonymous function I use on jQuery are the events like click:

<input id="myButton" type="button" value="Press me">
<script>
$('#myButton').click(function(){
    alert('Done!');
});
</script>

There are functions like $.ajax, that can have more than one callbacks, like this:

$.ajax({
    url: my.website.com,
})
.done(function() {
    alert( "success" );
})
.fail(function() {
    alert( "error" );
})
.always(function() {
    alert( "complete" );
});

On the symbol browser, this code looks like this:

image


#4

@stramin, thanks. I forgot to try functions () {}. That does it. It looks like we filter out anonymous functions defined with the arrow function but not when defined with the function keyword.

ie. This will remove all the anonymous funcs from the symbol browser (but could break your code…):


$.ajax({
    url: my.website.com,
})
.done(() => {
    alert( "success" );
})
.fail(() => {
    alert( "error" );
})
.always(() => {
    alert( "complete" );
});

Filed:

Just to be clear, I doubt I’ll be able to get to this before the release coming soon. There are quite a few high priority items that I’ll need to get to. Sorry, but don’t want to get your hopes up that this’ll get fixed right away.

  • Carey

#5

I see, I going to follow that topic, thank you!