DesktopSurface class

Namespace Runic.Desktop · Runic.Desktop 0.7.0-preview.5

public sealed class DesktopSurface : IAsyncDisposable

Inherits or implements IAsyncDisposable.

Owns content, capabilities, sessions, requests, and optional presentations for one namespace.

Properties

Url

public Uri Url { get; }

Gets the surface URL.

Methods

CloseAsync

public ValueTask CloseAsync(CancellationToken cancellationToken = default)

Closes the surface without stopping a listener shared by other surfaces.

DisposeAsync

public ValueTask DisposeAsync()

Remarks

From a capability or event callback, disposal continues after the callback returns: teardown waits for that callback's session to finish its disconnection event.

Inherits documentation from IAsyncDisposable.DisposeAsync.

ExecuteJavaScriptAsync

public Task<string> ExecuteJavaScriptAsync(string script, TimeSpan? timeout = null, int responseBufferSize = 4096, CancellationToken cancellationToken = default)

Runs JavaScript and returns its string result from an authenticated presentation session.

public Task NavigateAsync(string url, CancellationToken cancellationToken = default)

Navigates every authenticated presentation session.

OpenWindowAsync

public ValueTask<DesktopWindow> OpenWindowAsync(DesktopWindowOptions? options = null, CancellationToken cancellationToken = default)

Opens this surface in one installed browser or embedded WebView.

RegisterCapability

public PresentationCapabilityRegistration RegisterCapability(string capability, PresentationCapabilityHandler handler)

Registers or replaces a named presentation capability.

RunJavaScriptAsync

public Task RunJavaScriptAsync(string script, CancellationToken cancellationToken = default)

Runs JavaScript in every authenticated presentation session.

SendAsync

public Task SendAsync(string function, ReadOnlyMemory<byte> data, CancellationToken cancellationToken = default)

Sends opaque bytes to every authenticated presentation session.

SubscribeConnectionEvents

public IDisposable SubscribeConnectionEvents(Action<PresentationInvocation> handler)

Observes authenticated connection and disconnection events for this surface.