Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

destroyComponents报错 #141

Closed
ghost opened this issue Dec 13, 2023 · 2 comments
Closed

destroyComponents报错 #141

ghost opened this issue Dec 13, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@ghost
Copy link

ghost commented Dec 13, 2023

Version of js-screen-shot

1.9.9-rc.7

Operating system and its version

Windows

Browser and its version

版本 120.0.2210.61 (正式版本) (64 位)

Sandbox to reproduce

No response

What happened?

// 创建实例
let instance = new ScreenShot({
completeCallback,
closeCallback,
cancelCallback,
triggerCallback,
enableWebRtc: finalEnableWebRtc,
canvasWidth: window.innerWidth,
canvasHeight: window.innerHeight,
noScroll: false,
showScreenData: true,
position: { left: 0, top: 0 },
cropBoxInfo: {
x: 200,
y: 200,
w: window.innerWidth - 400,
h: window.innerHeight - 400,
},
level: 3000,
});

// 在回调中销毁实例
const completeCallback = () => {
instance.destroyComponents() // <------报错了
instance=null
}

报错信息

Uncaught DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.
@ghost ghost added the bug Something isn't working label Dec 13, 2023
@likaia
Copy link
Owner

likaia commented Dec 13, 2023

Hello @hahadaba. Your feedback has been received, and you will be notified in the issue area when the problem is resolved.
你好 @hahadaba,已收到你反馈的问题,问题解决后将在issue区域通知你。

@likaia
Copy link
Owner

likaia commented Jan 10, 2024

completeCallback

你的用法不对,当completeCallback回调执行的时候,dom已经被销毁了。你再次执行销毁方法,找不到dom,自然就报错了。

@likaia likaia closed this as completed Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant