Okay, so I've almost got the hang of promises.
I'm trying to figure out how to place a promise within view_functions so that the return works.
function loadViewFunctions(view_functions,append_data){
var this_app_data = [];
function viewFunctions(){
for (i = 0; i < view_functions.length; i++) {
this_app_data[i] = window[view_functions[i]]();
}
for (i = 0; i < this_app_data.length; i++) {
this_app_data[i].then(function(this_d) {
append_data = append_data + this_d;
});
}
return append_data;
}
//return
return viewFunctions().then(post_app_data => {
return post_app_data;
});
};