A web-application page contains two big components, which have callbacks called when they are fully rendered.
The problem is to call a function after both of the components are fully rendered.
This can probably be solved by using timeouts and polling some variables, but I guess there should be a better way.
Lets say, I have it like this:
function callMeAfterBothRendered() {...};
libA = libraryA($('.comp1'), {"rendered": function () {...}});
libB = libraryB($('.comp2'), {"rendered": function () {...}});
I've found some material on chained promises, but not quite sure how to apply it to this situation?
One complication is that in reality those libraries are not called directly in the same place (as is simplistically shown above), but in some init-methods deeper in the adapter "classes".
What could be good solution for this, which can also be easily generalized to 3 components?