I tried to prevent the interface response in the axios request interception function,
but I suspect this approach will cause memory leaks
Why is there no reference to data in the finally function?
Why is the data memory released?
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<button onclick="handleClick()">Click</button>
</body>
<script>
const task = (data) => {
// console.log(1)
new Promise((resolve, reject) => {
// console.log(2)
resolve();
}).then(() => {
// console.log(4)
return new Promise(() => {
})
}).finally(() => {
console.log("finally");
console.log(data);
})
// console.log(3)
}
function test() {
return Array(1000000).fill(new Date().toUTCString() + "1212121212121212");
}
window.onload = function () {
}
const handleClick = () => {
console.log("click ");
const data = test();
task(data);
}
</script>
</html>