Skip to content

Commit 4470410

Browse files
committed
📝 add details about Changed modifier with multiple traits
1 parent c15e6a3 commit 4470410

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,8 @@ const orphaned = world.query(Removed(ChildOf))
459459
460460
The `Changed` modifier tracks all entities that have had the specified traits or relation stores change since the last time the query was run. A new instance of the modifier must be created for tracking to be unique.
461461
462+
When multiple traits are passed to `Changed` it uses logical `AND`. Only entities where **all** specified traits have changed will be returned.
463+
462464
```js
463465
import { createChanged } from 'koota'
464466

@@ -470,6 +472,9 @@ const movedEntities = world.query(Changed(Position))
470472
// Track entities whose ChildOf relation data has changed
471473
const updatedChildren = world.query(Changed(ChildOf))
472474

475+
// Track entities where BOTH Position AND Velocity have changed
476+
const fullyUpdated = world.query(Changed(Position, Velocity))
477+
473478
// After running the query, the Changed modifier is reset
474479
```
475480

0 commit comments

Comments
 (0)