mirror of
https://github.com/Cysharp/UniTask.git
synced 2026-05-19 21:50:08 +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();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "com.cysharp.unitask",
|
||||
"displayName": "UniTask",
|
||||
"version": "1.1.0",
|
||||
"version": "1.2.0",
|
||||
"unity": "2018.3",
|
||||
"description": "Provides an efficient async/await integration to Unity.",
|
||||
"keywords": ["async/await", "async", "Task", "UniTask"],
|
||||
|
||||
Reference in New Issue
Block a user