Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: add example to query func #298

Merged
merged 1 commit into from
Aug 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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