-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Improve function names in debugger call stacks #3310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -58,6 +58,14 @@ module.exports.registerElement = function (tagName, obj) { | |
| newObj = {prototype: Object.create(proto, newObj)}; | ||
| } | ||
|
|
||
| // Give all functions their proper name. | ||
| for (const propName of Object.getOwnPropertyNames(newObj.prototype)) { | ||
| const propVal = newObj.prototype[propName]; | ||
| if (propVal && typeof propVal === 'function') { | ||
|
||
| propVal.displayName = propName; | ||
| } | ||
| } | ||
|
|
||
| return document.registerElement(tagName, newObj); | ||
| }; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -65,6 +65,20 @@ suite('a-register-element', function () { | |
| }); | ||
| document.body.appendChild(document.createElement('a-test-entity-2')); | ||
| }); | ||
|
|
||
| test.only('Names functions correctly', function (done) { | ||
|
||
| registerElement('a-test-entity-3', { | ||
| prototype: Object.create(AEntity.prototype, { | ||
| attachedCallback: { | ||
| value: function () { | ||
| assert.equal(this.attachedCallback.displayName, 'attachedCallback'); | ||
| done(); | ||
| } | ||
| } | ||
| }) | ||
| }); | ||
| document.body.appendChild(document.createElement('a-test-entity-3')); | ||
| }); | ||
| }); | ||
|
|
||
| suite('wrapMethods', function () { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not an es6 codebase