Skip to content

Commit

Permalink
chore: improve FeedbackStore
Browse files Browse the repository at this point in the history
  • Loading branch information
jstarpl committed Nov 22, 2023
1 parent 469d79c commit 283fe59
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/input-manager/src/devices/feedbackStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ export class FeedbackStore<T extends SomeFeedback> {
public get(feedbackId: string, triggerId: string | string[]): T | null {
const triggersInPriority = Array.isArray(triggerId) ? triggerId : [triggerId]

if (!this.feedbacks[feedbackId]) return null
const feedbackObj = this.feedbacks[feedbackId]
const feedbackObj = this.feedbacks[feedbackId] as Record<string, T> | undefined
if (!feedbackObj) return null

for (const trigger of triggersInPriority) {
if (feedbackObj[trigger]) return feedbackObj[trigger]
}
Expand All @@ -29,7 +30,7 @@ export class FeedbackStore<T extends SomeFeedback> {
this.feedbacks = {}
}

public allFeedbacks(): string[] {
public allFeedbackIds(): string[] {
return Array.from(Object.keys(this.feedbacks))
}
}

0 comments on commit 283fe59

Please sign in to comment.