mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-11-24 12:31:25 +00:00
fixed file upload after esbuild refactor
This commit is contained in:
parent
79b1d8ba4b
commit
5eb3e864fb
@ -14,9 +14,6 @@ body {
|
||||
</head>
|
||||
<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_dynamic" style="visibility:hidden">
|
||||
<!-- main menu -->
|
||||
|
@ -36,9 +36,6 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
|
||||
</head>
|
||||
<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_dynamic" style="visibility:hidden">
|
||||
<!-- main menu -->
|
||||
|
@ -256,7 +256,7 @@ export class AnimationTimer {
|
||||
scheduleFrame(msec:number) {
|
||||
var fn = (timestamp) => {
|
||||
try {
|
||||
this.nextFrame(timestamp*1000);
|
||||
this.nextFrame(timestamp);
|
||||
} catch (e) {
|
||||
this.running = false;
|
||||
this.pulsing = false;
|
||||
|
@ -247,10 +247,8 @@ export abstract class BaseWASIMachine extends BaseWASMMachine {
|
||||
return buffer.length;
|
||||
}
|
||||
async loadWASM() {
|
||||
await loadScript('node_modules/@wasmer/wasi/lib/index.iife.js'); //TODO: require('@wasmer/wasi');
|
||||
await loadScript('node_modules/@wasmer/wasmfs/lib/index.iife.js'); //TODO: require('@wasmer/wasi');
|
||||
let WASI = window['WASI'];
|
||||
let WasmFs = window['WasmFs'];
|
||||
let WASI = await import('@wasmer/wasi');
|
||||
let WasmFs = await import('@wasmer/wasmfs');
|
||||
this.wasmFs = new WasmFs.WasmFs();
|
||||
let bindings = WASI.WASI.defaultBindings;
|
||||
bindings.fs = this.wasmFs.fs;
|
||||
|
@ -484,11 +484,14 @@ function _createNewFile(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
|
||||
function handleFileUpload(files: File[]) {
|
||||
function handleFileUpload(files: FileList) {
|
||||
console.log(files);
|
||||
var index = 0;
|
||||
function uploadNextFile() {
|
||||
|
@ -41,7 +41,8 @@ var _c64 = require('gen/platform/c64.js');
|
||||
var _vectrex = require('gen/platform/vectrex.js');
|
||||
var _zx = require('gen/platform/zx.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