Skip to content

Commit

Permalink
doc: add example to query func
Browse files Browse the repository at this point in the history
  • Loading branch information
lajbel committed Aug 2, 2024
1 parent 3f78354 commit 34c00a0
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,30 @@ export interface KAPLAYCtx<
* @group Game Obj
*/
get(tag: Tag | Tag[], opts?: GetOpt): GameObj[];
/**
* Get a list of game objects in an advanced way.
*
* @example
* ```js
* const bean = k.add(["friend", "bean"]);
* const bean2 = k.add(["friend", "bean"]);
* const bag = k.add(["friend", "bag"]);
*
* // get bean
* query({
* include: "bean",
* }) // will return [bean, bean2];
*
* // get all friends excluding bean
* query({
* include: "friend",
* exclude: "bean",
* }); // will return [bag]
*
* ```
*
* @group Game Obj
*/
query(opt: QueryOpt): GameObj[];
/**
* Remove the game obj.
Expand Down

0 comments on commit 34c00a0

Please sign in to comment.