@bloopjs/web 0.0.67 → 0.0.68
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/dist/App.d.ts +2 -2
- package/dist/App.d.ts.map +1 -1
- package/dist/mod.js +17 -19
- package/dist/mod.js.map +4 -4
- package/package.json +3 -3
- package/src/App.ts +9 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bloopjs/web",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.68",
|
|
4
4
|
"author": "Neil Sarkar",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"typescript": "^5"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@bloopjs/bloop": "0.0.
|
|
37
|
-
"@bloopjs/engine": "0.0.
|
|
36
|
+
"@bloopjs/bloop": "0.0.68",
|
|
37
|
+
"@bloopjs/engine": "0.0.68",
|
|
38
38
|
"@preact/signals": "^1.3.1",
|
|
39
39
|
"partysocket": "^1.1.6",
|
|
40
40
|
"preact": "^10.25.4"
|
package/src/App.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
type Bloop,
|
|
3
|
+
type MountOptions,
|
|
4
|
+
mount,
|
|
5
|
+
type Sim,
|
|
6
|
+
} from "@bloopjs/bloop";
|
|
2
7
|
import type { Key } from "@bloopjs/engine";
|
|
3
8
|
import { mouseButtonCodeToMouseButton, readTapeHeader } from "@bloopjs/engine";
|
|
4
9
|
import { DebugUi, type DebugUiOptions } from "./debugui/mod.ts";
|
|
@@ -36,8 +41,7 @@ const DEFAULT_BROKER_URL = "wss://webrtc-divine-glade-8064.fly.dev/ws";
|
|
|
36
41
|
/** Start a bloop game on the web */
|
|
37
42
|
export async function start(opts: StartOptions): Promise<App> {
|
|
38
43
|
if (!opts.sim) {
|
|
39
|
-
const { sim } = await mount({
|
|
40
|
-
hooks: opts.game.hooks,
|
|
44
|
+
const { sim } = await mount(opts.game, {
|
|
41
45
|
startRecording: opts.startRecording ?? true,
|
|
42
46
|
wasmUrl: opts.engineWasmUrl,
|
|
43
47
|
});
|
|
@@ -374,7 +378,7 @@ export class App {
|
|
|
374
378
|
*/
|
|
375
379
|
async acceptHmr(
|
|
376
380
|
module: any,
|
|
377
|
-
opts?:
|
|
381
|
+
opts?: MountOptions & { files?: string[] },
|
|
378
382
|
): Promise<void> {
|
|
379
383
|
const game = (module.game ?? module) as Bloop<any>;
|
|
380
384
|
if (!game.hooks) {
|
|
@@ -385,8 +389,7 @@ export class App {
|
|
|
385
389
|
|
|
386
390
|
// load session from the current sim
|
|
387
391
|
this.sim.pause();
|
|
388
|
-
const { sim } = await mount({
|
|
389
|
-
hooks: game.hooks,
|
|
392
|
+
const { sim } = await mount(game, {
|
|
390
393
|
wasmUrl: new URL("/bloop-wasm/bloop.wasm", window.location.href),
|
|
391
394
|
...opts,
|
|
392
395
|
});
|