How to implement bidirectional callback calls in hybrid app? Is there a mature solution?

Much of the

JS code is chained down in the form of Callback.
but in the JS method chain, if you call the methods of iOS and Android, you can only break the chain. Wait for ios and Android to complete the operation, and then call a method of JS to continue the rest of the operation.

doing so will cause the program chain to break and affect the program design.

excuse me, is there a mature solution that allows iOS and Android methods to be called, just like normal JS methods, to be executed sequentially?
I probably have some ideas, but I think there should be a ready-made solution.

Thank you for your help

Mar.16,2021
Menu