mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2025-02-19 23:29:06 +00:00
fixed a couple bugs, local storage perist menu item
This commit is contained in:
parent
47aaa1d302
commit
4acff0051e
@ -64,7 +64,9 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
|
|||||||
<hr>
|
<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_include">Add Include File...</a></li>
|
||||||
<li><a class="dropdown-item" href="#" id="item_addfile_link">Add Linked 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_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>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li class="dropdown dropdown-submenu">
|
<li class="dropdown dropdown-submenu">
|
||||||
|
@ -396,7 +396,7 @@ export var SampleAudio = function(clockfreq) {
|
|||||||
console.log("no web audio context");
|
console.log("no web audio context");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var ctx = new AudioContext();
|
var ctx : AudioContext = new AudioContext();
|
||||||
self.context = ctx;
|
self.context = ctx;
|
||||||
self.sr=self.context.sampleRate;
|
self.sr=self.context.sampleRate;
|
||||||
self.bufferlen=2048;
|
self.bufferlen=2048;
|
||||||
@ -451,7 +451,7 @@ export var SampleAudio = function(clockfreq) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.stop = function() {
|
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
|
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
|
// 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 {
|
function getCurrentPresetTitle() : string {
|
||||||
if (!current_preset)
|
if (!current_preset)
|
||||||
return current_project.mainPath || "ROM";
|
return current_project.mainPath || "ROM";
|
||||||
@ -1518,6 +1530,7 @@ function setupDebugControls() {
|
|||||||
}
|
}
|
||||||
$("#item_addfile_include").click(_addIncludeFile);
|
$("#item_addfile_include").click(_addIncludeFile);
|
||||||
$("#item_addfile_link").click(_addLinkFile);
|
$("#item_addfile_link").click(_addLinkFile);
|
||||||
|
$("#item_request_persist").click(requestPersistPermission);
|
||||||
updateDebugWindows();
|
updateDebugWindows();
|
||||||
// show help button?
|
// show help button?
|
||||||
if (platform.showHelp) {
|
if (platform.showHelp) {
|
||||||
|
@ -569,8 +569,10 @@ export class MemoryView implements ProjectView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
scrollToAddress(addr : number) {
|
scrollToAddress(addr : number) {
|
||||||
|
if (this.dumplines) {
|
||||||
this.memorylist.scrollToItem(this.findMemoryWindowLine(addr));
|
this.memorylist.scrollToItem(this.findMemoryWindowLine(addr));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
refresh() {
|
refresh() {
|
||||||
this.dumplines = null;
|
this.dumplines = null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user