Skip to content

Commit 61fb713

Browse files
committed
Fixed wait until available #61
1 parent 127c0a4 commit 61fb713

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Diff for: CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Released on Tuesday, March 31 2020.
44

55
- Fixed deadlock with some versions of jQuery (#63)
66
- Enabled the instance creator factory (#11)
7+
- Return `IDocument` from `WaitUntilAvailable()` (#61)
78

89
# 0.13.0
910

Diff for: src/AngleSharp.Js/JsDocumentExtensions.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,11 @@ public static Task<IDocument> WhenStable(this Task<IDocument> documentTask) =>
102102
/// <param name="documentTask">The document task to await.</param>
103103
/// <param name="cancellation">The timeout cancellation, if any.</param>
104104
/// <returns>A task that is finished when the document is available.</returns>
105-
public static async Task WaitUntilAvailable(this Task<IDocument> documentTask, CancellationToken cancellation = default)
105+
public static async Task<IDocument> WaitUntilAvailable(this Task<IDocument> documentTask, CancellationToken cancellation = default)
106106
{
107107
var document = await documentTask.ConfigureAwait(false);
108108
await document.WaitUntilAvailable(cancellation).ConfigureAwait(false);
109+
return document;
109110
}
110111

111112
/// <summary>
@@ -116,7 +117,7 @@ public static async Task WaitUntilAvailable(this Task<IDocument> documentTask, C
116117
/// <param name="document">The document to await.</param>
117118
/// <param name="cancellation">The timeout cancellation, if any.</param>
118119
/// <returns>A task that is finished when the document is available.</returns>
119-
public static async Task WaitUntilAvailable(this IDocument document, CancellationToken cancellation = default)
120+
public static async Task<IDocument> WaitUntilAvailable(this IDocument document, CancellationToken cancellation = default)
120121
{
121122
if (document.ReadyState != DocumentReadyState.Complete)
122123
{
@@ -126,6 +127,7 @@ public static async Task WaitUntilAvailable(this IDocument document, Cancellatio
126127
}
127128

128129
await document.WhenStable().ConfigureAwait(false);
130+
return document;
129131
}
130132
}
131133
}

0 commit comments

Comments
 (0)