mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-12-25 15:30:03 +00:00
fixed a couple bugs, local storage perist menu item
This commit is contained in:
parent
00913e55e5
commit
53669cd579
@ -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">
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
15
src/ui.ts
15
src/ui.ts
@ -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) {
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user