Skip to content

Commit

Permalink
add note about reactivity in BehaviorMap
Browse files Browse the repository at this point in the history
  • Loading branch information
trusktr committed May 14, 2024
1 parent a6eb408 commit 5483a7d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/BehaviorMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export class BehaviorMap extends Map<string, PossibleBehaviorInstance> {
find(predicate: (name: string, behavior: PossibleBehaviorInstance) => boolean) {
let result: PossibleBehaviorInstance | undefined = void undefined

// Note, this for-of loop accesses Symbol.iterator which makes find()
// reactive.
for (const [name, behavior] of this) {
if (!predicate(name, behavior)) continue
result = behavior
Expand Down

0 comments on commit 5483a7d

Please sign in to comment.