ToAsyncLazy

This commit is contained in:
neuecc
2020-05-05 04:17:08 +09:00
parent b8d1a09224
commit 75f0bd26e7
3 changed files with 71 additions and 0 deletions

View File

@@ -180,6 +180,16 @@ namespace UniRx.Async
}
}
public static AsyncLazy ToAsyncLazy(this UniTask task)
{
return new AsyncLazy(task.Preserve()); // require Preserve
}
public static AsyncLazy<T> ToAsyncLazy<T>(this UniTask<T> task)
{
return new AsyncLazy<T>(task.Preserve()); // require Preserve
}
public static IEnumerator ToCoroutine<T>(this UniTask<T> task, Action<T> resultHandler = null, Action<Exception> exceptionHandler = null)
{
return new ToCoroutineEnumerator<T>(task, resultHandler, exceptionHandler);