Commit 1d69f3a5 authored by Allen Bai's avatar Allen Bai

feat: 卸载与重新挂载的功能

parent 3487c03b
...@@ -89,6 +89,10 @@ const defaultBoardStyles: Optional<CSSStyleDeclaration> = { ...@@ -89,6 +89,10 @@ const defaultBoardStyles: Optional<CSSStyleDeclaration> = {
fontSize: '12px' fontSize: '12px'
} }
/**
* 挂载
* @param {IPCFooterOptions} opts
*/
async function mountIPCFooter(opts: IPCFooterOptions = {}) { async function mountIPCFooter(opts: IPCFooterOptions = {}) {
let IPCNumberString = '' let IPCNumberString = ''
try { try {
...@@ -109,4 +113,24 @@ async function mountIPCFooter(opts: IPCFooterOptions = {}) { ...@@ -109,4 +113,24 @@ async function mountIPCFooter(opts: IPCFooterOptions = {}) {
targetDom.appendChild(IPCFooter) targetDom.appendChild(IPCFooter)
} }
export default { getIPCByDomain, mountIPCFooter } /**
* 卸载
*/
function unmount() {
let target = document.getElementById('__IPC_footer__')
if (target) {
let parent = target.parentElement
parent.removeChild(target)
}
}
/**
* 重新挂载
* @param {IPCFooterOptions} opts
*/
function remount(opts: IPCFooterOptions = {}) {
unmount()
mountIPCFooter(opts)
}
export default { getIPCByDomain, mountIPCFooter, unmount, remount }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment