I have a problem with timers. I know that if I set obj = nul;
or delete object delete obj;
it will removed from memory. But it not works if I have interval in my object. delete
and obj = null;
not working. How to delete a timers without doing this in the deleted object.
I think Angular4 clear only those timers from component that will be removed. Background timers not remove.
function MyFunc() {
setInterval(function () {
console.log('Interval');
}, 1000);
}
var obj = new(MyFunc.bind({
message: 'some_message'
}));
// From some time remove object
setTimeout(function() {
delete obj;
console.log('Delete object');
}, 5000);
Sorry for english.