mirror of
https://github.com/He4eT/elseifplayer.git
synced 2026-05-05 01:17:22 +00:00
Experimental integration of cheap-glkote with emglken
This commit is contained in:
parent
830ef7ea53
commit
5c5839fb44
1 changed files with 20 additions and 1 deletions
|
|
@ -2,6 +2,13 @@ import { h } from 'preact'
|
||||||
|
|
||||||
import { getFileExtension } from '~/src/utils/utils.routing'
|
import { getFileExtension } from '~/src/utils/utils.routing'
|
||||||
|
|
||||||
|
import CheapGlkOte from 'cheap-glkote'
|
||||||
|
import engine from 'emglken/src/tads.js'
|
||||||
|
|
||||||
|
const blobToFile = fileName => theBlob =>{
|
||||||
|
return new File([theBlob], fileName)
|
||||||
|
}
|
||||||
|
|
||||||
export default function ({setTheme, theme, encodedUrl}) {
|
export default function ({setTheme, theme, encodedUrl}) {
|
||||||
setTheme(theme)
|
setTheme(theme)
|
||||||
|
|
||||||
|
|
@ -11,7 +18,19 @@ export default function ({setTheme, theme, encodedUrl}) {
|
||||||
const fetchGameFile = fetch(url)
|
const fetchGameFile = fetch(url)
|
||||||
.then(response => (console.log(response), response))
|
.then(response => (console.log(response), response))
|
||||||
.then(response => response.blob())
|
.then(response => response.blob())
|
||||||
.then(console.log)
|
.then(blob => new Response(blob).arrayBuffer())
|
||||||
|
.then(buffer => new Uint8Array(buffer))
|
||||||
|
.then(file => {
|
||||||
|
console.log(file)
|
||||||
|
const {glkInterface, sendFn} = CheapGlkOte({
|
||||||
|
onUpdateContent: messages => console.log(messages)
|
||||||
|
})
|
||||||
|
window.send = sendFn
|
||||||
|
|
||||||
|
const vm = new engine()
|
||||||
|
vm.prepare(file, glkInterface)
|
||||||
|
vm.start()
|
||||||
|
})
|
||||||
.catch(console.log)
|
.catch(console.log)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue