Package 

Class SingleJob


  • 
    public final class SingleJob
    
                        

    Runs a single coroutine job at a time.

    If a previous job is running, cancels it before launching the new one.

    • Constructor Summary

      Constructors 
      Constructor Description
      SingleJob(CoroutineScope scope)
    • Method Summary

      Modifier and Type Method Description
      final Unit launch(SuspendFunction1<CoroutineScope, Unit> block) Launches a coroutine job.
      final Unit cancel() Cancels the current job, if any.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SingleJob

        SingleJob(CoroutineScope scope)
    • Method Detail

      • launch

         final Unit launch(SuspendFunction1<CoroutineScope, Unit> block)

        Launches a coroutine job.

        If a previous job is running, cancels it before launching the new one.

      • cancel

         final Unit cancel()

        Cancels the current job, if any.