Yan
November 25, 2026, 2:05am
1
import "https://zimjs.org/cdn/020/zim";
import GUI from 'https://cdn.jsdelivr.net/npm/lil-gui@0.21/+esm';
var tempZimFrame = null;
var guiD = {
makeZimFrame: function () {
tempZimFrame = new Frame({
scaling: "fit",
color: "#03f",
outerColor: black
});
clearBtn.show();
makeBtn.hide();
},
clearZimFrame: function () {
tempZimFrame.dispose();
tempZimFrame = null;
clearBtn.hide();
makeBtn.show();
}
};
var debugGui = new GUI({ title: "调试" });
var makeBtn = debugGui.add(guiD, "makeZimFrame").name("make||创建").show();
var clearBtn = debugGui.add(guiD, "clearZimFrame").name("clear||清除").hide();
if dispose frame then have error
import "https://zimjs.org/cdn/020/zim";
new Frame(FIT, 1024, 768, light, dark, ready);
function ready() {
timeout(2, ()=>{
F.dispose();
F = null;
});
}
works fine for us. (Works storing the Frame in let f = and disposing and nullifying that too)
Not sure where the loc_ZIM.js is... Do you possibly have another ZIM running?
Yan
November 25, 2026, 1:28pm
3
Yan:
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>clearZimFrame error</title>
<script type="module">
import "https://zimjs.org/cdn/020/zim";
import GUI from 'https://cdn.jsdelivr.net/npm/lil-gui@0.21/+esm';
var tempZimFrame = null;
var guiD = {
makeZimFrame: function () {
tempZimFrame = new Frame({ scaling: 'fit', color: '#03f', outerColor: black });
clearBtn.show();
makeBtn.hide();
},
clearZimFrame: function () {
tempZimFrame.dispose();
tempZimFrame = null;
clearBtn.hide();
makeBtn.show();
},
};
var debugGui = new GUI({ title: "调试" });
var makeBtn = debugGui.add(guiD, 'makeZimFrame').name('make||创建').show();
var clearBtn = debugGui.add(guiD, 'clearZimFrame').name('clear||清除').hide();
</script>
<meta name="viewport" content="width=device-width, user-scalable=no" />
</head>
<body>
</body>
</html>
the error be reported when i use gui,
Yan
November 26, 2026, 1:18am
4
loc_ZIM.js is my local host file name.
the error be reported when use gui dispose frame.
Oh - maybe because ZIM Frame is passed into the GUI and then you set the Frame to null - so the GUI is trying to access something on null?
Yan
November 26, 2026, 8:54am
6
no,in ZIM018,no the error.
import "https://zimjs.org/cdn/018/zim.js ";
Yan
November 26, 2026, 1:22pm
7
1 Like
Ah... interesting. So the event is firing as you press to dispose. And then it disposes and we run the timeout. Okay - we think that is fixed. Cheers. Clear your cache, try it out and let us know.
1 Like