fixes + subCancel
This commit is contained in:
parent
1a1c8af250
commit
a72d96865c
3 changed files with 30 additions and 5 deletions
|
@ -15,7 +15,7 @@ Stear.addGlobalStyleJSON({
|
|||
transition: "background-color 200ms",
|
||||
backgroundColor: "#212121",
|
||||
color:"#fafafa",
|
||||
"-webkit-user-select": "none",
|
||||
webkitUserSelect: "none",
|
||||
|
||||
},".stear_status");
|
||||
|
||||
|
|
|
@ -122,9 +122,9 @@ export class SFrame{
|
|||
|
||||
export class SWindow extends SFrame{
|
||||
|
||||
#Frame
|
||||
#Frame;
|
||||
|
||||
constructor({ preRender, render, call }){
|
||||
constructor({ preRender, render, call, backgroundColor = "transparent"}){
|
||||
var Frame = _({
|
||||
style: {
|
||||
top: "0px",
|
||||
|
@ -132,8 +132,11 @@ export class SWindow extends SFrame{
|
|||
position: "absolute",
|
||||
height: "100%",
|
||||
width: "100%",
|
||||
display: "block"
|
||||
}
|
||||
display: "block",
|
||||
backgroundColor,
|
||||
overflow:"scroll"
|
||||
},
|
||||
find:"main"
|
||||
}, []);
|
||||
super({
|
||||
preRender, render: (settings, args) => {
|
||||
|
|
|
@ -37,3 +37,25 @@ export const fadein = async (elems, ms = 200, force = false) => {
|
|||
}
|
||||
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();
|
||||
});
|
Loading…
Reference in a new issue