Merge pull request #16243 from Snuffleupagus/toolbars-object-spread
Use object-spread when dispatching events in the toolbars
This commit is contained in:
commit
1c7e2defea
@ -203,11 +203,7 @@ class SecondaryToolbar {
|
||||
for (const { element, eventName, close, eventDetails } of this.buttons) {
|
||||
element.addEventListener("click", evt => {
|
||||
if (eventName !== null) {
|
||||
const details = { source: this };
|
||||
for (const property in eventDetails) {
|
||||
details[property] = eventDetails[property];
|
||||
}
|
||||
this.eventBus.dispatch(eventName, details);
|
||||
this.eventBus.dispatch(eventName, { source: this, ...eventDetails });
|
||||
}
|
||||
if (close) {
|
||||
this.close();
|
||||
|
@ -150,13 +150,7 @@ class Toolbar {
|
||||
for (const { element, eventName, eventDetails } of this.buttons) {
|
||||
element.addEventListener("click", evt => {
|
||||
if (eventName !== null) {
|
||||
const details = { source: this };
|
||||
if (eventDetails) {
|
||||
for (const property in eventDetails) {
|
||||
details[property] = eventDetails[property];
|
||||
}
|
||||
}
|
||||
this.eventBus.dispatch(eventName, details);
|
||||
this.eventBus.dispatch(eventName, { source: this, ...eventDetails });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user