mirror of
https://github.com/He4eT/elseifplayer.git
synced 2026-05-05 01:17:22 +00:00
Player: explicitly override Engine arguments
This commit is contained in:
parent
8a79c5dd3d
commit
2fdc39c1f0
2 changed files with 10 additions and 4 deletions
|
|
@ -20,17 +20,18 @@ const INITIAL_STATUS = {
|
|||
|
||||
const runMachine = ({ engine: Engine, wasmBinary, storyfile, handlers }) => {
|
||||
const { Dialog, GlkOte, send } = CheapGlkOte(handlers)
|
||||
const vm = new Engine()
|
||||
const instance = new Engine()
|
||||
|
||||
vm.init(storyfile, {
|
||||
instance.init(storyfile, {
|
||||
Dialog,
|
||||
GlkOte,
|
||||
Glk: {},
|
||||
wasmBinary,
|
||||
arguments: ['storyfile'],
|
||||
})
|
||||
vm.start()
|
||||
instance.start()
|
||||
|
||||
return { send, instance: vm }
|
||||
return { send, instance }
|
||||
}
|
||||
|
||||
export default function Player ({
|
||||
|
|
@ -68,6 +69,7 @@ export default function Player ({
|
|||
window.addEventListener('unhandledrejection', rejectionHandler)
|
||||
|
||||
return () => {
|
||||
setVm(null)
|
||||
window.removeEventListener('unhandledrejection', rejectionHandler)
|
||||
}
|
||||
}, [storyfile, engine, wasmBinary])
|
||||
|
|
@ -76,6 +78,8 @@ export default function Player ({
|
|||
setSendMessage(() => vm
|
||||
? vm.send
|
||||
: null)
|
||||
|
||||
return () => setSendMessage(null)
|
||||
}, [vm])
|
||||
|
||||
const textWindow = (inbox) => (currentWindow) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue