mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Add dispose terminal button to demo
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
</div>
|
||||
<hr/>
|
||||
<p><strong>Attention:</strong> The demo is a barebones implementation and is designed for the development and evaluation of xterm.js only. Exposing the demo to the public as is would introduce security risks for the host.</p>
|
||||
<button id="dispose" title="This is used to testing memory leaks">Dispose terminal</button>
|
||||
<script src="dist/bundle.js" defer ></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -76,6 +76,12 @@ function createTerminal() {
|
||||
term.fit();
|
||||
term.focus();
|
||||
|
||||
document.getElementById('dispose').addEventListener('click', () => {
|
||||
term.dispose();
|
||||
term = null;
|
||||
window.term = null;
|
||||
});
|
||||
|
||||
// fit is called within a setTimeout, cols and rows need this.
|
||||
setTimeout(function () {
|
||||
initOptions(term);
|
||||
|
||||
Reference in New Issue
Block a user