EsriEduNL / veldwerk2.0

WebApp to use ArcGIS Online Organization account for student field trips
GNU General Public License v2.0
1 stars 0 forks source link

List functions #46

Open dhunink opened 9 years ago

dhunink commented 9 years ago

When a user submit's the deleteGroup form inside the modal, we need to make a list of several functions dat have to be executed in a deferred chain. For example: All([vCalls.deleteGroup(groupid), vCalls.deleteUser(user1), vCalls.deleteUser(user2)]) The exact vCalls that have to be executed are dynamic. Therefore we need a way to make that array of functions, but not executing them until we really return the all.

What's a proper way to do that? The following example is not working; alle vCalls are executed as soon as their mentions:

var allvCallsArr = [vCalls.deleteGroup(groupid)] if($('#modal-delete-group input[name=delete-questions]').val() == 'yes') { allvCallsArr.push(vCalls.deleteQuestionsForGroup(getMapsForGroupResp.items[0].id, groupid)); } return All(allvCallsArr);