Here is my code:
Promise.all([twitter_ajax(), instagram_ajax(), facebook_ajax()]).then(() => {
stopBlinking()
formSubmited = false;
}).catch( (err) => {
console.error(err);
stopBlinking()
formSubmited = false;
})
Since I have a setting system in my project, I need to make those three ajax requests dynamic. I mean sometimes I need to send all of them, other times I need to send both of those, or probably one of them. It's all depend on the setting configured by user.
Any idea how can I handle that?
Here is my idea which has syntax error. I store the setting into cookie and can access it like this:
var functions = getCookie($ajaxRequests);
//=> twitter_ajax(), instagram_ajax(), facebook_ajax()
See? I have a string of a part of my code. But sadly this doesn't work:
Promise.all([ functions ]){ ... }