mirror of
https://github.com/Cysharp/UniTask.git
synced 2026-05-17 20:50:11 +00:00
GetCancellationTokenOnDestroy is moved to UnIRx.Async namespace
This commit is contained in:
@@ -3,6 +3,25 @@
|
||||
|
||||
using System.Threading;
|
||||
using UnityEngine;
|
||||
using UniRx.Async.Triggers;
|
||||
|
||||
namespace UniRx.Async
|
||||
{
|
||||
public static class UniTaskCancellationExtensions
|
||||
{
|
||||
/// <summary>This CancellationToken is canceled when the MonoBehaviour will be destroyed.</summary>
|
||||
public static CancellationToken GetCancellationTokenOnDestroy(this GameObject gameObject)
|
||||
{
|
||||
return gameObject.GetAsyncDestroyTrigger().CancellationToken;
|
||||
}
|
||||
|
||||
/// <summary>This CancellationToken is canceled when the MonoBehaviour will be destroyed.</summary>
|
||||
public static CancellationToken GetCancellationTokenOnDestroy(this Component component)
|
||||
{
|
||||
return component.GetAsyncDestroyTrigger().CancellationToken;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace UniRx.Async.Triggers
|
||||
{
|
||||
@@ -36,18 +55,6 @@ namespace UniRx.Async.Triggers
|
||||
return component.GetAsyncDestroyTrigger().OnDestroyAsync();
|
||||
}
|
||||
|
||||
/// <summary>This CancellationToken is canceled when the MonoBehaviour will be destroyed.</summary>
|
||||
public static CancellationToken GetCancellationTokenOnDestroy(this GameObject gameObject)
|
||||
{
|
||||
return gameObject.GetAsyncDestroyTrigger().CancellationToken;
|
||||
}
|
||||
|
||||
/// <summary>This CancellationToken is canceled when the MonoBehaviour will be destroyed.</summary>
|
||||
public static CancellationToken GetCancellationTokenOnDestroy(this Component component)
|
||||
{
|
||||
return component.GetAsyncDestroyTrigger().CancellationToken;
|
||||
}
|
||||
|
||||
public static UniTask StartAsync(this GameObject gameObject)
|
||||
{
|
||||
return gameObject.GetAsyncStartTrigger().StartAsync();
|
||||
|
||||
Reference in New Issue
Block a user