取消注册自定义元素 [英] Unregister custom element
问题描述
是否可以注销由createCustomElement创建的自定义元素?
Is it possible to unregister a custom element that has been created by createCustomElement?
我们使用Web组件包装垂直功能,即功能的所有部分是在将Web组件添加到DOM之前下载的。
We use Web Components to wrap out vertical features, all 'parts' of the feature are downloaded before the Web Component is added to the DOM.
我们真正想要的是在该功能不再有效但看上去像该功能时完全销毁该组件。没有可用的API。
What we would really like is to completely destroy the component when the feature is no longer active but there it looks like there is no API available.
有人对此有运气吗?
推荐答案
在Angular级别上, @ angular / elements
。
At the Angular level, there doesn't seem to be any "destroy" or "remove" function alongside createCustomElement
in @angular/elements
.
在DOM级别上,查看 CustomElementRegistry
接口,由 customElements
,没有与 define
伴随的未定义或类似的内容。 (这可能就是Angular没有销毁或删除的原因的一部分。)
At the DOM level, looking at the CustomElementRegistry
interface, the interface provided by customElements
, there is no "undefine" or similar to accompany define
. (This may be part of why Angular doesn't have a "destroy" or "remove"...)
所以我会说:不,可以删除它。
So I'd say: No, you can't remove it.
这篇关于取消注册自定义元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!