Skip to content

Commit

Permalink
Fix to support async functions
Browse files Browse the repository at this point in the history
  • Loading branch information
rimuy committed Jan 3, 2022
1 parent 748a6a7 commit 1fa41f9
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 14 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Simply execute the command below to install it to your [roblox-ts](https://roblo
npm i @rbxts/gamejoy
```

<!--
### Wally
For [wally](https://wally.run/) users, the package can be installed by adding the following line into their `wally.toml`.
```cs
Expand All @@ -23,6 +24,7 @@ GameJoy = "rimuy/[email protected]"
```
After that, just run `wally install`.
-->

### From model file
Model files are uploaded to every release as `.rbxmx` files. You can download the file from the [Releases page](https://github.com/HylianBasement/GameJoy/releases) and load it into your project however you see fit.
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rbxts/gamejoy",
"version": "1.0.0",
"version": "1.0.2",
"description": "A simple class-based input library",
"main": "out/init.lua",
"types": "out/index.d.ts",
Expand All @@ -16,6 +16,7 @@
"test:rojo": "rojo build tests -o ./tests/test.rbxlx",
"test:run": "run-in-roblox --place ./tests/test.rbxlx --script ./tests/out/testBootstrap.server.lua",
"test:update-package": "cd tests && npm i @rbxts/gamejoy@latest",
"publish:wally": "npm run build:model && wally publish",
"prepublishOnly": "npm run build",
"postpublish": "npm run test:update-package"
},
Expand Down
10 changes: 7 additions & 3 deletions src/Class/ActionQueue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ActionEntry, ActionListener } from "../Definitions/Types";
interface QueueEntry {
Action: ActionEntry;
Bin: Bin;
Executable: () => Promise<void>;
Executable: () => Promise<Promise<void>>;
IsExecuting: boolean;
}

Expand Down Expand Up @@ -95,8 +95,12 @@ export class ActionQueue {
const bin = new Bin();

const exe = () => {
const execute = Promise.try(() => {
chosenListener();
const execute = Promise.try(async () => {
const result = chosenListener();

if (Promise.is(result)) {
await result;
}

Queue.remove(0);
chosenAction.Resolved.Fire();
Expand Down
14 changes: 7 additions & 7 deletions tests/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@rbxts/types": "^1.0.550"
},
"dependencies": {
"@rbxts/gamejoy": "^1.0.0",
"@rbxts/gamejoy": "^1.0.2",
"@rbxts/services": "^1.2.0",
"@rbxts/testez": "^0.3.1-ts.7"
}
Expand Down

0 comments on commit 1fa41f9

Please sign in to comment.