mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2025-05-14 03:38:18 +00:00
cache result of failed web load; fixed tour
This commit is contained in:
parent
dc40d1b040
commit
3221d43cdc
@ -22,7 +22,6 @@ TODO:
|
|||||||
- run apple CPU until boot
|
- run apple CPU until boot
|
||||||
- better disasm/listing selection
|
- better disasm/listing selection
|
||||||
- disasm for z80
|
- disasm for z80
|
||||||
- projects w/ include files
|
|
||||||
- watchpoints
|
- watchpoints
|
||||||
- breakpoints
|
- breakpoints
|
||||||
- debug inspector
|
- debug inspector
|
||||||
@ -45,6 +44,7 @@ TODO:
|
|||||||
- more UI tests
|
- more UI tests
|
||||||
- base-36 encoding for LZG
|
- base-36 encoding for LZG
|
||||||
- disassembler for uploaded ROMs
|
- disassembler for uploaded ROMs
|
||||||
|
- show tool-specific (readonly) include files
|
||||||
|
|
||||||
|
|
||||||
WEB WORKER FORMAT
|
WEB WORKER FORMAT
|
||||||
|
@ -41,7 +41,7 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
|
|||||||
|
|
||||||
<div id="controls_top">
|
<div id="controls_top">
|
||||||
<span class="dropdown">
|
<span class="dropdown">
|
||||||
<a class="btn btn-secondary dropdown-toggle" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
<a class="btn btn-secondary dropdown-toggle" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="Menu">
|
||||||
☰ <span class="caret"></span>
|
☰ <span class="caret"></span>
|
||||||
</a>
|
</a>
|
||||||
<ul class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
<ul class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
||||||
@ -84,11 +84,11 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
|
|||||||
</ul>
|
</ul>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<select id="preset_select" name="">
|
<select id="preset_select" name="" title="Project Select">
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<span class="dropdown">
|
<span class="dropdown">
|
||||||
<a class="btn btn-secondary dropdown-toggle" id="windowMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
<a class="btn btn-secondary dropdown-toggle" id="windowMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="Window Select">
|
||||||
☯ <span class="caret"></span>
|
☯ <span class="caret"></span>
|
||||||
</a>
|
</a>
|
||||||
<ul class="dropdown-menu" aria-labelledby="windowMenuButton" id="windowMenuList">
|
<ul class="dropdown-menu" aria-labelledby="windowMenuButton" id="windowMenuList">
|
||||||
|
@ -35,7 +35,7 @@ body {
|
|||||||
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
|
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
|
||||||
<script src="bootstrap/js/bootstrap.min.js"></script>
|
<script src="bootstrap/js/bootstrap.min.js"></script>
|
||||||
<script src="FileSaver.js/FileSaver.min.js"></script>
|
<script src="FileSaver.js/FileSaver.min.js"></script>
|
||||||
<script src="src/util.js"></script>
|
<script src="gen/util.js"></script>
|
||||||
<script src="src/pixed/pixeleditor.js"></script>
|
<script src="src/pixed/pixeleditor.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
@ -185,40 +185,49 @@ export class CodeProject {
|
|||||||
|
|
||||||
// TODO: get local file as well as presets?
|
// TODO: get local file as well as presets?
|
||||||
loadFiles(paths:string[], callback:LoadFilesCallback) {
|
loadFiles(paths:string[], callback:LoadFilesCallback) {
|
||||||
var result = [];
|
var result : Dependency[] = [];
|
||||||
|
function addResult(path, data) {
|
||||||
|
result.push({
|
||||||
|
path:path,
|
||||||
|
filename:getFilenameForPath(path),
|
||||||
|
data:data
|
||||||
|
});
|
||||||
|
}
|
||||||
var loadNext = () => {
|
var loadNext = () => {
|
||||||
var path = paths.shift();
|
var path = paths.shift();
|
||||||
if (!path) {
|
if (!path) {
|
||||||
callback(null, result); // TODO?
|
// finished loading all files; return result
|
||||||
|
callback(null, result);
|
||||||
} else {
|
} else {
|
||||||
|
// look in store
|
||||||
this.store.getItem(path, (err, value) => {
|
this.store.getItem(path, (err, value) => {
|
||||||
if (err) {
|
if (err) { // err fetching from store
|
||||||
callback(err, result);
|
callback(err, result);
|
||||||
} else if (value) {
|
} else if (value) { // found in store?
|
||||||
result.push({
|
|
||||||
path:path,
|
|
||||||
filename:getFilenameForPath(path),
|
|
||||||
data:value
|
|
||||||
});
|
|
||||||
this.filedata[path] = value;
|
this.filedata[path] = value;
|
||||||
|
addResult(path, value);
|
||||||
loadNext();
|
loadNext();
|
||||||
} else {
|
} else if (path in this.filedata) { // found in cache?
|
||||||
|
var data = this.filedata[path];
|
||||||
|
if (data)
|
||||||
|
addResult(path, data);
|
||||||
|
loadNext();
|
||||||
|
} else { // found on remote fetch?
|
||||||
var webpath = "presets/" + this.platform_id + "/" + path;
|
var webpath = "presets/" + this.platform_id + "/" + path;
|
||||||
if (this.platform_id == 'vcs' && path.indexOf('.') <= 0)
|
if (this.platform_id == 'vcs' && path.indexOf('.') <= 0)
|
||||||
webpath += ".a"; // legacy stuff
|
webpath += ".a"; // legacy stuff
|
||||||
// TODO: cache files
|
|
||||||
this.callbackGetRemote( webpath, (text:string) => {
|
this.callbackGetRemote( webpath, (text:string) => {
|
||||||
console.log("GET",webpath,text.length,'bytes');
|
console.log("GET",webpath,text.length,'bytes');
|
||||||
result.push({
|
|
||||||
path:path,
|
|
||||||
filename:getFilenameForPath(path),
|
|
||||||
data:text
|
|
||||||
});
|
|
||||||
this.filedata[path] = text;
|
this.filedata[path] = text;
|
||||||
|
addResult(path, text);
|
||||||
loadNext();
|
loadNext();
|
||||||
}, 'text')
|
}, 'text')
|
||||||
.fail(function() {
|
.fail( (err:XMLHttpRequest) => {
|
||||||
callback("Could not load preset " + path, result);
|
console.log("Could not load preset", path, err);
|
||||||
|
// only cache result if status is 404 (not found)
|
||||||
|
if (err.status && err.status == 404)
|
||||||
|
this.filedata[path] = null;
|
||||||
|
loadNext();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
24
src/ui.js
24
src/ui.js
@ -688,15 +688,12 @@ function showWelcomeMessage() {
|
|||||||
if (!localStorage.getItem("8bitworkshop.hello")) {
|
if (!localStorage.getItem("8bitworkshop.hello")) {
|
||||||
// Instance the tour
|
// Instance the tour
|
||||||
var is_vcs = platform_id == 'vcs';
|
var is_vcs = platform_id == 'vcs';
|
||||||
var tour = new Tour({
|
var steps = [
|
||||||
autoscroll:false,
|
|
||||||
//storage:false,
|
|
||||||
steps: [
|
|
||||||
{
|
{
|
||||||
element: "#editor",
|
element: "#workspace",
|
||||||
title: "Welcome to 8bitworkshop!",
|
title: "Welcome to 8bitworkshop!",
|
||||||
content: is_vcs ? "Type your 6502 assembly code into the editor, and it'll be assembled in real-time. All changes are saved to browser local storage."
|
content: is_vcs ? "Type your 6502 assembly code into the editor, and it'll be assembled in real-time. All changes are saved to browser local storage."
|
||||||
: "Type your C source code into the editor, and it'll be compiled in real-time. All changes are saved to browser local storage."
|
: "Type your source code into the editor, and it'll be compiled in real-time. All changes are saved to browser local storage."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
element: "#emulator",
|
element: "#emulator",
|
||||||
@ -719,8 +716,19 @@ function showWelcomeMessage() {
|
|||||||
element: "#dropdownMenuButton",
|
element: "#dropdownMenuButton",
|
||||||
title: "Main Menu",
|
title: "Main Menu",
|
||||||
content: "Click the menu to switch between platforms, create new files, or share your work with others."
|
content: "Click the menu to switch between platforms, create new files, or share your work with others."
|
||||||
},
|
}];
|
||||||
]});
|
if (!is_vcs) {
|
||||||
|
steps.push({
|
||||||
|
element: "#windowMenuButton",
|
||||||
|
title: "Window List",
|
||||||
|
content: "Switch between editor windows, assembly listings, and other tools like disassembler and memory dump."
|
||||||
|
});
|
||||||
|
}
|
||||||
|
var tour = new Tour({
|
||||||
|
autoscroll:false,
|
||||||
|
//storage:false,
|
||||||
|
steps:steps
|
||||||
|
});
|
||||||
tour.init();
|
tour.init();
|
||||||
setTimeout(function() { tour.start(); }, 2000);
|
setTimeout(function() { tour.start(); }, 2000);
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ var addr2symbol : {[addr:number]:string};
|
|||||||
var current_project;
|
var current_project;
|
||||||
var VirtualList;
|
var VirtualList;
|
||||||
var lastDebugState;
|
var lastDebugState;
|
||||||
var pixeditframe;
|
|
||||||
|
|
||||||
// TODO: functions
|
// TODO: functions
|
||||||
var inspectVariable;
|
var inspectVariable;
|
||||||
@ -238,7 +237,7 @@ function SourceEditor(path, mode) {
|
|||||||
function openBitmapEditorWithParams(fmt, bytestr, palfmt, palstr) {
|
function openBitmapEditorWithParams(fmt, bytestr, palfmt, palstr) {
|
||||||
$("#pixeditback").show();
|
$("#pixeditback").show();
|
||||||
window.addEventListener("message", handleWindowMessage, false); // TODO: remove listener
|
window.addEventListener("message", handleWindowMessage, false); // TODO: remove listener
|
||||||
pixeditframe.contentWindow.postMessage({fmt:fmt, bytestr:bytestr, palfmt:palfmt, palstr:palstr}, '*');
|
window['pixeditframe'].contentWindow.postMessage({fmt:fmt, bytestr:bytestr, palfmt:palfmt, palstr:palstr}, '*');
|
||||||
}
|
}
|
||||||
|
|
||||||
function lookBackwardsForJSONComment(line, req) {
|
function lookBackwardsForJSONComment(line, req) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user