feat: initial import
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using R3;
|
||||
|
||||
namespace GodotHostTest.Helpers;
|
||||
|
||||
public static class ObservableHelpers
|
||||
{
|
||||
public static IDisposable SubscribeOnce<T>(this Observable<T> observable, Action<T> action)
|
||||
{
|
||||
IDisposable? disposable = null;
|
||||
disposable = observable.Subscribe(x =>
|
||||
{
|
||||
// ReSharper disable once AccessToModifiedClosure
|
||||
disposable?.Dispose();
|
||||
action(x);
|
||||
});
|
||||
return disposable;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user