()
| 4 | const res = []; |
| 5 | |
| 6 | function checkResources() { |
| 7 | for (let i = res.length - 1; i >= 0; --i) { |
| 8 | if (res[i].detached || !document.body.contains(res[i].$dom[0])) { |
| 9 | if (!res[i].detached) res[i].detach(); |
| 10 | res.splice(i, 1); |
| 11 | } |
| 12 | } |
| 13 | if (res.length === 0) { |
| 14 | clearInterval(removalChecker); |
| 15 | removalChecker = null; |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | function monitorResource(resource) { |
| 20 | res.push(resource); |