If I have:
fetched_user.settings = null;
fetched_user.settings = JSON.stringify(settings);
$http.post('/api_endpoint', {
val: fetched_user.settings
});
And JSON.stringify takes forever to execute, then my understanding is val: fetched_user.settings will likely be null since this is executed asynchronously (async newbie checkpoint: is this correct?).
Normally in these situations I would supply a callback function to be executed on completion of the long-running task, however, JSON.stringify() doesn't provide the option for a callback.
How should I write this?
setTimeout.