1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-12-26 07:29:22 +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 00913e55e5
commit 53669cd579
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

@ -397,7 +397,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
@ -104,6 +103,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";
@ -1492,6 +1504,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,8 +569,10 @@ export class MemoryView implements ProjectView {
}
scrollToAddress(addr : number) {
if (this.dumplines) {
this.memorylist.scrollToItem(this.findMemoryWindowLine(addr));
}
}
refresh() {
this.dumplines = null;