为什么调用`URL.revokeObjectURL`方法会有40秒的延迟?

问题描述 投票:0回答:1

源代码FileSaver.js#L106

a.href = URL.createObjectURL(blob)
setTimeout(function () { URL.revokeObjectURL(a.href) }, 4E4) // 40s
setTimeout(function () { click(a) }, 0)

为什么调用

URL.revokeObjectURL
方法会有40秒的延迟?打电话后为什么不马上打电话
URL.createObjectURL(blob)

javascript dom
1个回答
0
投票
If the URL is immediately revoked, the resource will be unavailable when the next line of code (asynchronous event) runs. There would be a failure to download or a broken link to the image if the resource was not accessible.The best practice is to determine the appropriate delay. If you are able to get the file in less time, then use that delay
© www.soinside.com 2019 - 2024. All rights reserved.