Skip to content

Commit

Permalink
Remove redundant method in NativeBridge
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredjj3 committed Jun 23, 2024
1 parent 99b382d commit 9b56a63
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/events/nativebridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class NativeBridge<V extends string> {

/** Returns whether the vexml event is activated. */
isActivated(vexmlEventName: V) {
return this.isVexmlEventActive(vexmlEventName);
return vexmlEventName in this.handles;
}

/**
Expand All @@ -49,7 +49,7 @@ export class NativeBridge<V extends string> {
* the event is not already active.
*/
activate(vexmlEventName: V) {
util.assert(!this.isVexmlEventActive(vexmlEventName), `vexml event is already active: ${vexmlEventName}`);
util.assert(!this.isActivated(vexmlEventName), `vexml event is already active: ${vexmlEventName}`);

const mapping = this.mappings.find((m) => m.vexml.includes(vexmlEventName));
if (!mapping) {
Expand Down Expand Up @@ -79,7 +79,7 @@ export class NativeBridge<V extends string> {
* that the event is not already inactive.
*/
deactivate(vexmlEventName: V) {
util.assert(this.isVexmlEventActive(vexmlEventName), `vexml event is already inactive: ${vexmlEventName}`);
util.assert(this.isActivated(vexmlEventName), `vexml event is already inactive: ${vexmlEventName}`);

const mapping = this.mappings.find((m) => m.vexml.includes(vexmlEventName));
if (!mapping) {
Expand Down Expand Up @@ -122,9 +122,4 @@ export class NativeBridge<V extends string> {
this.nativeEventTopic.publish(event.type as keyof HTMLElementEventMap, event);
return false;
};

/** Returns whether the vexml event is currently active. */
private isVexmlEventActive(vexmlEventName: V) {
return vexmlEventName in this.handles;
}
}

0 comments on commit 9b56a63

Please sign in to comment.