I am looking to create a JavaScript class that can register multiple functions to run with a common callback. Each registered function should run asynchronously, and once they have all completed, the specified callback function should be executed.
In addition, I would like to set a maximum time limit for the callback function to execute. For example, if this limit is set to 3000 milliseconds and the registered functions take longer than 3000 ms to return, the callback function should still proceed without waiting for all functions to finish their execution.
The code needs to be flexible, standalone, and reusable. It should assume that any registered function will call a specific function we define to mark its completion. For example, at the end of a function, I would use myClass.markDone() to signal to the class that it has finished executing.
Is it possible to achieve this using JavaScript or Angular.js without relying on jQuery?