mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-11-28 08:50:22 +00:00
fixed file upload after esbuild refactor
This commit is contained in:
parent
79b1d8ba4b
commit
5eb3e864fb
@ -14,9 +14,6 @@ body {
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<!-- for file upload -->
|
|
||||||
<input type="file" id="uploadFileElem" multiple accept="*" style="display:none" onchange="handleFileUpload(this.files)">
|
|
||||||
|
|
||||||
<div id="controls_top" class="disable-select">
|
<div id="controls_top" class="disable-select">
|
||||||
<div id="controls_dynamic" style="visibility:hidden">
|
<div id="controls_dynamic" style="visibility:hidden">
|
||||||
<!-- main menu -->
|
<!-- main menu -->
|
||||||
|
@ -36,9 +36,6 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<!-- for file upload -->
|
|
||||||
<input type="file" id="uploadFileElem" multiple accept="*" style="display:none" onchange="handleFileUpload(this.files)">
|
|
||||||
|
|
||||||
<div id="controls_top" class="disable-select">
|
<div id="controls_top" class="disable-select">
|
||||||
<div id="controls_dynamic" style="visibility:hidden">
|
<div id="controls_dynamic" style="visibility:hidden">
|
||||||
<!-- main menu -->
|
<!-- main menu -->
|
||||||
|
@ -256,7 +256,7 @@ export class AnimationTimer {
|
|||||||
scheduleFrame(msec:number) {
|
scheduleFrame(msec:number) {
|
||||||
var fn = (timestamp) => {
|
var fn = (timestamp) => {
|
||||||
try {
|
try {
|
||||||
this.nextFrame(timestamp*1000);
|
this.nextFrame(timestamp);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.running = false;
|
this.running = false;
|
||||||
this.pulsing = false;
|
this.pulsing = false;
|
||||||
|
@ -247,10 +247,8 @@ export abstract class BaseWASIMachine extends BaseWASMMachine {
|
|||||||
return buffer.length;
|
return buffer.length;
|
||||||
}
|
}
|
||||||
async loadWASM() {
|
async loadWASM() {
|
||||||
await loadScript('node_modules/@wasmer/wasi/lib/index.iife.js'); //TODO: require('@wasmer/wasi');
|
let WASI = await import('@wasmer/wasi');
|
||||||
await loadScript('node_modules/@wasmer/wasmfs/lib/index.iife.js'); //TODO: require('@wasmer/wasi');
|
let WasmFs = await import('@wasmer/wasmfs');
|
||||||
let WASI = window['WASI'];
|
|
||||||
let WasmFs = window['WasmFs'];
|
|
||||||
this.wasmFs = new WasmFs.WasmFs();
|
this.wasmFs = new WasmFs.WasmFs();
|
||||||
let bindings = WASI.WASI.defaultBindings;
|
let bindings = WASI.WASI.defaultBindings;
|
||||||
bindings.fs = this.wasmFs.fs;
|
bindings.fs = this.wasmFs.fs;
|
||||||
|
@ -484,11 +484,14 @@ function _createNewFile(e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function _uploadNewFile(e) {
|
function _uploadNewFile(e) {
|
||||||
$("#uploadFileElem").click();
|
const uploadFileElem = $(`<input type="file" multiple accept="*" style="display:none">`);
|
||||||
|
const file = uploadFileElem[0] as HTMLInputElement;
|
||||||
|
uploadFileElem.change((e) => { handleFileUpload(file.files) });
|
||||||
|
uploadFileElem.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
// called from index.html
|
// called from index.html
|
||||||
function handleFileUpload(files: File[]) {
|
function handleFileUpload(files: FileList) {
|
||||||
console.log(files);
|
console.log(files);
|
||||||
var index = 0;
|
var index = 0;
|
||||||
function uploadNextFile() {
|
function uploadNextFile() {
|
||||||
|
@ -41,7 +41,8 @@ var _c64 = require('gen/platform/c64.js');
|
|||||||
var _vectrex = require('gen/platform/vectrex.js');
|
var _vectrex = require('gen/platform/vectrex.js');
|
||||||
var _zx = require('gen/platform/zx.js');
|
var _zx = require('gen/platform/zx.js');
|
||||||
var _atari8 = require('gen/platform/atari8.js');
|
var _atari8 = require('gen/platform/atari8.js');
|
||||||
|
var util = require('gen/common/util.js');
|
||||||
|
util.loadScript = function(s) { console.log('tried to load',s); } // for vcs
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user