Skip to content

Commit

Permalink
return interface to game engine
Browse files Browse the repository at this point in the history
  • Loading branch information
customcommander committed Sep 8, 2024
1 parent 3339983 commit 15e40fe
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,23 @@ const machine = src.createMachine({
}
});

export default () => {
return createActor(machine, {
systemId: 'gamesys'
});
export default function () {
return new class {
constructor() {
this.actor = createActor(machine, {systemId: 'gamesys'});
}
start() {
this.actor.start();
}
send(event) {
this.actor.send(event);
}
subscribe(handler) {
return this.actor.subscribe(handler);
}
getSnapshot() {
return this.actor.getSnapshot();
}
};
}

0 comments on commit 15e40fe

Please sign in to comment.