DEV: Make decorator method names debug-friendly (#16181)

Example

Before: `_decorate_5`
After: `_decorate_5_chat_transcript_datetime`
This commit is contained in:
Jarek Radosz 2022-03-14 15:12:54 +01:00 committed by GitHub
parent 0400d10907
commit fa7d34f593
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -1693,11 +1693,18 @@ function decorate(klass, evt, cb, id) {
}
const mixin = {};
mixin["_decorate_" + _decorateId++] = on(evt, function (elem) {
let name = `_decorate_${_decorateId++}`;
if (id) {
name += `_${id.replaceAll(/\W/g, "_")}`;
}
mixin[name] = on(evt, function (elem) {
elem = elem || this.element;
if (elem) {
cb(elem);
}
});
klass.reopen(mixin);
}