简体   繁体   English

如何破坏hterm提供的Terminal对象?

[英]How to destruct Terminal object provided by hterm?

I'm using libapps/hterm. 我正在使用libapps / hterm。 I had read the document about how to construct a hterm.Terminal and use it. 我已经阅读有关如何构建和使用hterm.Terminal 的文档

But I didn't find anything helpful about how can I destroy the Terminal. 但是我发现如何销毁终端机没有任何帮助。

How can I do that? 我怎样才能做到这一点?

Here, destroy means remove the DOM element, remove event listeners, and make the Terminal object may be GCed. 在这里,destroy意味着删除DOM元素,删除事件侦听器,并使Terminal对象可以被GC。

Hterm is already using an iframe for the terminal. Hterm已经在终端上使用iframe。 When you call hterms decorate method you are telling hterm that your div is the container to be used for the terminal You can hide the div that was used to decorate the terminal by setting it to display:none. 当您调用hterms decorate方法时,您会告诉hterm您的div是用于终端的容器。通过将其设置为display:none,可以隐藏用于装饰终端的div。 This will not free up the object to free the object set the variable that is referring the hterm.terminal object and any other variables In your code that reference hterm to null. 这不会释放对象,也无法释放对象,将引用hterm.terminal对象的变量和引用hterm的任何其他变量设置为null。 Once there are no references to the object, the garbage collector will free its memory. 一旦没有对该对象的引用,垃圾收集器将释放其内存。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM