Add dispose terminal button to demo

This commit is contained in:
Daniel Imms
2018-06-21 10:32:58 +10:00
parent 7e779cd195
commit 9293616f02
2 changed files with 7 additions and 0 deletions
+1
View File
@@ -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>
+6
View File
@@ -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);