コード例 #1
0
 public static UniTask RaiseIfNotNull <T>(this AsyncEventRaiser <T>?raiser, T arg, CancellationToken cancellationToken = default)
 {
     if (raiser is not null)
     {
         return(raiser.Raise(arg, cancellationToken));
     }
     else
     {
         if (cancellationToken.IsCancellationRequested)
         {
             return(UniTask.FromCanceled(cancellationToken));
         }
         else
         {
             return(UniTask.CompletedTask);
         }
     }
 }
コード例 #2
0
 internal AsyncEventUnsubscriber(AsyncEventRaiser <T>?raiser, Func <T, CancellationToken, UniTask>?func)
 {
     _raiser = raiser;
     _func   = func;
 }