1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-11-25 18:33:11 +00:00

fixed a couple bugs, local storage perist menu item

This commit is contained in:
Steven Hugg 2019-09-03 19:48:12 -04:00
parent 47aaa1d302
commit 4acff0051e
4 changed files with 21 additions and 4 deletions

View File

@ -64,7 +64,9 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
<hr>
<li><a class="dropdown-item" href="#" id="item_addfile_include">Add Include File...</a></li>
<li><a class="dropdown-item" href="#" id="item_addfile_link">Add Linked File...</a></li>
<hr>
<li><a class="dropdown-item" href="#" id="item_switch_https" style="display:none">Switch to HTTPS...</a></li>
<li><a class="dropdown-item" href="#" id="item_request_persist">Request Local Storage Permissions</a></li>
</ul>
</li>
<li class="dropdown dropdown-submenu">

View File

@ -396,7 +396,7 @@ export var SampleAudio = function(clockfreq) {
console.log("no web audio context");
return;
}
var ctx = new AudioContext();
var ctx : AudioContext = new AudioContext();
self.context = ctx;
self.sr=self.context.sampleRate;
self.bufferlen=2048;
@ -451,7 +451,7 @@ export var SampleAudio = function(clockfreq) {
}
this.stop = function() {
this.context && this.context.suspend();
this.context && this.context.suspend && this.context.suspend();
clearBuffers(); // just in case it doesn't stop immediately
}

View File

@ -1,4 +1,3 @@
"use strict";
// 8bitworkshop IDE user interface
@ -114,6 +113,19 @@ var hasLocalStorage : boolean = function() {
}
}();
// https://developers.google.com/web/updates/2016/06/persistent-storage
function requestPersistPermission() {
if (navigator.storage && navigator.storage.persist) {
navigator.storage.persist().then(persistent=>{
if (persistent) {
alertInfo("We asked your browser to persist local data, and it said yes.");
} else {
alertInfo("This browser may not persist local data. Are you in a private window?");
}
});
}
}
function getCurrentPresetTitle() : string {
if (!current_preset)
return current_project.mainPath || "ROM";
@ -1518,6 +1530,7 @@ function setupDebugControls() {
}
$("#item_addfile_include").click(_addIncludeFile);
$("#item_addfile_link").click(_addLinkFile);
$("#item_request_persist").click(requestPersistPermission);
updateDebugWindows();
// show help button?
if (platform.showHelp) {

View File

@ -569,7 +569,9 @@ export class MemoryView implements ProjectView {
}
scrollToAddress(addr : number) {
this.memorylist.scrollToItem(this.findMemoryWindowLine(addr));
if (this.dumplines) {
this.memorylist.scrollToItem(this.findMemoryWindowLine(addr));
}
}
refresh() {