I am relatively new to working with JavaScript and Angular technology. I have encountered a situation where two separate pieces of code are running in different callbacks, triggered by third-party libraries (specifically Kendo UI library callbacks).
One function, Function A(), initiates a $scope.evalAsync operation.
Function B() relies on the data set by Function A() to carry out its tasks accordingly. However, due to being in different scopes, these two functions cannot directly interact with each other.
The execution of Function B() needs to wait for Function A() to complete before it can proceed.
Is there an elegant solution to achieve this? One possibility I am considering is adding another boolean variable to $rootScope and pausing a function until it changes from false to true.
Unfortunately, using $q promises is not an option in this case because A() and B() are both triggered by separate callbacks within the third-party library without shared scope.