Class ContextBinder


  • public class ContextBinder
    extends Object
    Binds closures to contexts that were active at the time of binding. This can be used to transfer contexts when passing callbacks to async functions:
     class MyComponent {
    
         @Inject ContextBinder ctxBinder;
    
         void methodThatCallsSomeAsyncMethod(...) {
             // other code here...
             someAsyncMethod(arg1, ... arN, ctxBinder.bindToContext((callbackParam) -> {
                 // callback code here...
             }));
         }
     }

    Deriving libs should bind this class in their main Module.