Skip to content

Commit

Permalink
chore: do not expose PlaywrightEvent (#2797)
Browse files Browse the repository at this point in the history
  • Loading branch information
mxschmitt authored Dec 11, 2023
1 parent f947487 commit 71f74af
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 89 deletions.
33 changes: 0 additions & 33 deletions src/Playwright/API/IEvent.cs

This file was deleted.

3 changes: 1 addition & 2 deletions src/Playwright/Core/BrowserContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -536,8 +536,7 @@ internal string _effectiveCloseReason()
return _closeReason ?? _browser._closeReason;
}

[MethodImpl(MethodImplOptions.NoInlining)]
public async Task<T> InnerWaitForEventAsync<T>(PlaywrightEvent<T> playwrightEvent, Func<Task> action = default, Func<T, bool> predicate = default, float? timeout = default)
internal async Task<T> InnerWaitForEventAsync<T>(PlaywrightEvent<T> playwrightEvent, Func<Task> action = default, Func<T, bool> predicate = default, float? timeout = default)
{
if (playwrightEvent == null)
{
Expand Down
3 changes: 1 addition & 2 deletions src/Playwright/Core/Page.cs
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,7 @@ internal TargetClosedException _closeErrorWithReason()
return new TargetClosedException(_closeReason ?? Context._effectiveCloseReason());
}

[MethodImpl(MethodImplOptions.NoInlining)]
public async Task<T> InnerWaitForEventAsync<T>(PlaywrightEvent<T> pageEvent, Func<Task> action = default, Func<T, bool> predicate = default, float? timeout = default)
internal async Task<T> InnerWaitForEventAsync<T>(PlaywrightEvent<T> pageEvent, Func<Task> action = default, Func<T, bool> predicate = default, float? timeout = default)
{
if (pageEvent == null)
{
Expand Down
51 changes: 0 additions & 51 deletions src/Playwright/Core/PageEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,88 +26,37 @@ namespace Microsoft.Playwright.Core;

internal static class PageEvent
{
/// <summary>
/// <see cref="PlaywrightEvent{T}"/> representing a <see cref="IPage.Request"/>.
/// </summary>
public static PlaywrightEvent<IRequest> Request { get; } = new() { Name = "Request" };

/// <summary>
/// <see cref="PlaywrightEvent{T}"/> representing a <see cref="IPage.RequestFinished"/>.
/// </summary>
public static PlaywrightEvent<IRequest> RequestFinished { get; } = new() { Name = "RequestFinished" };

/// <summary>
/// <see cref="PlaywrightEvent{T}"/> representing a <see cref="IPage.Crash"/>.
/// </summary>
public static PlaywrightEvent<IPage> Crash { get; } = new() { Name = "Crash" };

/// <summary>
/// <see cref="PlaywrightEvent{T}"/> representing a <see cref="IPage.Close"/>.
/// </summary>
public static PlaywrightEvent<IPage> Close { get; } = new() { Name = "Close" };

/// <summary>
/// <see cref="PlaywrightEvent{T}"/> representing a <see cref="IPage.Response"/>.
/// </summary>
public static PlaywrightEvent<IResponse> Response { get; } = new() { Name = "Response" };

/// <summary>
/// <see cref="PlaywrightEvent{T}"/> representing a <see cref="IPage.Download"/>.
/// </summary>
public static PlaywrightEvent<IDownload> Download { get; } = new() { Name = "Download" };

/// <summary>
/// <see cref="PlaywrightEvent{T}"/> representing a <see cref="IPage.Console"/>.
/// </summary>
public static PlaywrightEvent<IConsoleMessage> Console { get; } = new() { Name = "Console" };

/// <summary>
/// <see cref="PlaywrightEvent{T}"/> representing a <see cref="IPage.Popup"/>.
/// </summary>
public static PlaywrightEvent<IPage> Popup { get; } = new() { Name = "Popup" };

/// <summary>
/// <see cref="PlaywrightEvent{T}"/> representing a <see cref="IPage.FrameNavigated"/>.
/// </summary>
public static PlaywrightEvent<IFrame> FrameNavigated { get; } = new() { Name = "FrameNavigated" };

/// <summary>
/// <see cref="PlaywrightEvent{T}"/> representing a <see cref="IPage.FrameDetached"/>.
/// </summary>
public static PlaywrightEvent<IFrame> FrameDetached { get; } = new() { Name = "FrameDetached" };

/// <summary>
/// <see cref="PlaywrightEvent{T}"/> representing a <see cref="IPage.Worker"/>.
/// </summary>
public static PlaywrightEvent<IWorker> Worker { get; } = new() { Name = "Worker" };

/// <summary>
/// <see cref="PlaywrightEvent{T}"/> representing a <see cref="IPage.Dialog"/>.
/// </summary>
public static PlaywrightEvent<IDialog> Dialog { get; } = new() { Name = "Dialog" };

/// <summary>
/// <see cref="PlaywrightEvent{T}"/> representing a <see cref="IPage.FileChooser"/>.
/// </summary>
public static PlaywrightEvent<IFileChooser> FileChooser { get; } = new() { Name = "FileChooser" };

/// <summary>
/// <see cref="PlaywrightEvent{T}"/> representing a <see cref="IPage.PageError"/>.
/// </summary>
public static PlaywrightEvent<string> PageError { get; } = new() { Name = "PageError" };

/// <summary>
/// <see cref="PlaywrightEvent{T}"/> representing a <see cref="IPage.Load"/>.
/// </summary>
public static PlaywrightEvent<IPage> Load { get; } = new() { Name = "Load" };

/// <summary>
/// <see cref="PlaywrightEvent{T}"/> representing a <see cref="IPage.DOMContentLoaded"/>.
/// </summary>
public static PlaywrightEvent<IPage> DOMContentLoaded { get; } = new() { Name = "DOMContentLoaded" };

/// <summary>
/// <see cref="PlaywrightEvent{T}"/> representing a <see cref="IPage.WebSocket"/>.
/// </summary>
public static PlaywrightEvent<IWebSocket> WebSocket { get; } = new() { Name = "WebSocket" };
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

namespace Microsoft.Playwright;

public class PlaywrightEvent<T> : IEvent
internal class PlaywrightEvent<T>
{
public string Name { get; set; }
}

0 comments on commit 71f74af

Please sign in to comment.