Ticket #9375 (assigned defect)
support for WebKit's displayName feature of naming anonymous functions
| Reported by: | pmuellr | Owned by: | alex |
|---|---|---|---|
| Priority: | normal | Milestone: | future |
| Component: | General | Version: | 1.3.0 |
| Severity: | normal | Keywords: | |
| Cc: |
Description
See:
http://www.alertdebugging.com/2009/04/29/building-a-better-javascript-profiler-with-webkit/
I suspect it would be possible to enable dojo to do some automatic naming of functions on behalf of the user. For instance, when defining classes, iterating through the properties looking for functions, associating the property name with the function name. Also on event handlers.
The logic should probably involve checking the "name" property of the function first, and if undefined, then setting displayName as appropriate.
The name doesn't have to be just the name of the function. I've played around a bit with some other frameworks where I tack on "class" names before the function name, and distinguish "class" methods from "instance" methods by separating the class and function name with different characters. eg, SomeClass?.classMethod and SomeClass::instanceMethod.