fixes + subCancel

This commit is contained in:
jusax23 2022-06-10 01:07:55 +02:00
parent 1a1c8af250
commit a72d96865c
3 changed files with 30 additions and 5 deletions

View file

@ -15,7 +15,7 @@ Stear.addGlobalStyleJSON({
transition: "background-color 200ms", transition: "background-color 200ms",
backgroundColor: "#212121", backgroundColor: "#212121",
color:"#fafafa", color:"#fafafa",
"-webkit-user-select": "none", webkitUserSelect: "none",
},".stear_status"); },".stear_status");

View file

@ -122,9 +122,9 @@ export class SFrame{
export class SWindow extends SFrame{ export class SWindow extends SFrame{
#Frame #Frame;
constructor({ preRender, render, call }){ constructor({ preRender, render, call, backgroundColor = "transparent"}){
var Frame = _({ var Frame = _({
style: { style: {
top: "0px", top: "0px",
@ -132,8 +132,11 @@ export class SWindow extends SFrame{
position: "absolute", position: "absolute",
height: "100%", height: "100%",
width: "100%", width: "100%",
display: "block" display: "block",
} backgroundColor,
overflow:"scroll"
},
find:"main"
}, []); }, []);
super({ super({
preRender, render: (settings, args) => { preRender, render: (settings, args) => {

View file

@ -37,3 +37,25 @@ export const fadein = async (elems, ms = 200, force = false) => {
} }
await wait(ms); await wait(ms);
} }
var bStack = [];
export const subCancel = (callback) => {
bStack.push(callback);
return ()=>{
var id;
if ((id = bStack.indexOf(callback)) >= 0) {
bStack.splice(id, 1);
}
}
}
function back() {
if (bStack.length) {
bStack.pop()();
}
}
document.addEventListener("backbutton", back, false);
document.addEventListener('keyup', (e)=>{
if (e.code == "Escape")back();
});