Replace `fireEvent` by `fire`
This seems to be more consistent and clearer to use. But also it enables
us to check that the type of the event detail as declared in
`HTMLElementEventMap` is actually `{}`.
I could not get this to work with an optional parameter, but I think
it is actually fine to force callers to add `{}` as a parameter to
`fire()` calls.
Release-Notes: skip
Change-Id: I6d7eb523f6a4d2d98d0ed3016f3bc7cd9c74c8fa
diff --git a/polygerrit-ui/app/elements/admin/gr-rule-editor/gr-rule-editor.ts b/polygerrit-ui/app/elements/admin/gr-rule-editor/gr-rule-editor.ts
index 2888229..4e41dfe 100644
--- a/polygerrit-ui/app/elements/admin/gr-rule-editor/gr-rule-editor.ts
+++ b/polygerrit-ui/app/elements/admin/gr-rule-editor/gr-rule-editor.ts
@@ -8,7 +8,7 @@
import '../../shared/gr-select/gr-select';
import {encodeURL, getBaseUrl} from '../../../utils/url-util';
import {AccessPermissionId} from '../../../utils/access-util';
-import {fire, fireEvent} from '../../../utils/event-util';
+import {fire} from '../../../utils/event-util';
import {formStyles} from '../../../styles/gr-form-styles';
import {sharedStyles} from '../../../styles/shared-styles';
import {LitElement, PropertyValues, html, css} from 'lit';
@@ -424,14 +424,14 @@
private handleRemoveRule() {
if (!this.rule?.value) return;
if (this.rule.value.added) {
- fireEvent(this, 'added-rule-removed');
+ fire(this, 'added-rule-removed', {});
}
this.deleted = true;
this.rule.value.deleted = true;
this.handleRuleChange();
- fireEvent(this, 'access-modified');
+ fire(this, 'access-modified', {});
}
private handleUndoRemove() {
@@ -469,7 +469,7 @@
this.handleRuleChange();
// Allows overall access page to know a change has been made.
- fireEvent(this, 'access-modified');
+ fire(this, 'access-modified', {});
}
// private but used in test