haxball.js 2.1.3 → 2.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -42
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -89,48 +89,6 @@ You may run the server with `ts-node room.ts` instead of `node room.js`. To make
|
|
|
89
89
|
//...
|
|
90
90
|
```
|
|
91
91
|
|
|
92
|
-
#### 💻 (Optional) Modularize Room Script
|
|
93
|
-
You can build full room scripts as NPM packages, that export `roomBuilder` function. These functions can be easily imported by another packages (launchers, remote orchestrators, etc.).
|
|
94
|
-
|
|
95
|
-
```ts
|
|
96
|
-
// super-futsal-room/index.ts
|
|
97
|
-
|
|
98
|
-
import { Headless } from "haxball.js"
|
|
99
|
-
|
|
100
|
-
// Every user installing the package will have to
|
|
101
|
-
// implement this interface in order to run it.
|
|
102
|
-
interface RoomArgs {
|
|
103
|
-
token: string
|
|
104
|
-
timeLimit: number
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const roomBuilder = (HBInit: Headless, args: RoomArgs) => {
|
|
108
|
-
let room = HBInit({
|
|
109
|
-
roomName: "Hello TypeScript!",
|
|
110
|
-
token: args.token
|
|
111
|
-
})
|
|
112
|
-
|
|
113
|
-
room.setTimeLimit(args.timeLimit)
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
export default roomBuilder;
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
```ts
|
|
120
|
-
// room-launcher/index.ts
|
|
121
|
-
|
|
122
|
-
// Local path as example, but may refer to installed npm package
|
|
123
|
-
import roomBuilder from "../super-futsal-room";
|
|
124
|
-
import HaxballJS from "haxball.js";
|
|
125
|
-
|
|
126
|
-
HaxballJS.then((HBInit => roomBuilder(HBInit, {
|
|
127
|
-
// Interface for config arguments is provided by the room script author
|
|
128
|
-
// Not defining them results in TypeScript error
|
|
129
|
-
token: "YOUR_TOKEN_HERE",
|
|
130
|
-
timeLimit: 3
|
|
131
|
-
})))
|
|
132
|
-
```
|
|
133
|
-
|
|
134
92
|
---
|
|
135
93
|
|
|
136
94
|
<h2 id="technologies">🚀 Technologies</h2>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "haxball.js",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.4",
|
|
4
4
|
"description": "A powerful library for interacting with the Haxball Headless API",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@koush/wrtc": "^0.5.3",
|
|
21
21
|
"@peculiar/webcrypto": "^1.3.3",
|
|
22
|
-
"@types/haxball-headless-browser": "
|
|
22
|
+
"@types/haxball-headless-browser": ">=0.3.0",
|
|
23
23
|
"http-proxy-agent": "^5.0.0",
|
|
24
24
|
"json5": "^2.2.1",
|
|
25
25
|
"pako": "^2.0.4",
|