Handling uploads / Garbage collector

Hey guys,
I’m having a question about handling uploads. For example, we’re having a chat application where the user is able to shoot a profile picture. This happens on the start page. We’re handling the upload within our Blaze template (ViewModel) and a jQuery POST request. Now I’m wondering if the user should be able to start the chat immediately without waiting for the upload to be finished or if we should block the start button until the upload has finished.

Because we’re handling the upload within our Blaze template, the template will be destroyed when the user clicks on “start”. On my first test, the upload is still working even if the template was destroyed. Also all variables within the ViewModel (f.e. uploadPercentage) are still available during the upload. I’m just wondering if this is a kind of “guaranteed behavior” or this may be fail because of garbage collection / low memory on mobile devices?

So I guess my main question is, if all async functions like $.ajax will still work even if the template gets destroyed?

Yes, this is a guarantee because of the closure that gets created. Only after the async task completes will the references be releases and the memory be available for garbage collection.