-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
619 additions
and
732 deletions.
There are no files selected for viewing
Submodule GDTask.Nuget.Test
updated
4 files
+9 −2 | ApiUsage.cs | |
+6 −0 | Main.tscn | |
+0 −3 | Test.tscn | |
+5 −1 | project.godot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using System; | ||
|
||
namespace GodotTask; | ||
|
||
public static partial class TaskTracker | ||
{ | ||
internal record TrackingData(string FormattedType, int TrackingId, DateTime AddTime, string StackTrace, Func<GDTaskStatus> StatusProvider); | ||
|
||
internal class ObservableProperty : IObservable<bool> | ||
{ | ||
public static implicit operator bool(ObservableProperty observableProperty) | ||
{ | ||
return observableProperty._value; | ||
} | ||
|
||
public ObservableProperty(bool value) | ||
{ | ||
_value = value; | ||
} | ||
|
||
public bool Value | ||
{ | ||
get => _value; | ||
set | ||
{ | ||
_value = value; | ||
|
||
if (_singleSubscriber is null) return; | ||
|
||
_singleSubscriber.OnNext(_value); | ||
_singleSubscriber.OnCompleted(); | ||
} | ||
} | ||
|
||
private IObserver<bool>? _singleSubscriber; | ||
|
||
private bool _value; | ||
|
||
public IDisposable Subscribe(IObserver<bool> observer) | ||
{ | ||
_singleSubscriber = observer; | ||
observer.OnNext(_value); | ||
return new DisposeHandle(this); | ||
} | ||
|
||
internal class DisposeHandle : IDisposable | ||
{ | ||
private readonly ObservableProperty _property; | ||
|
||
public DisposeHandle(ObservableProperty property) => _property = property; | ||
|
||
public void Dispose() => _property._singleSubscriber = null; | ||
} | ||
} | ||
} |
Oops, something went wrong.