콘텐츠로 이동

AppHandle

이 콘텐츠는 아직 번역되지 않았습니다.

Namespace NetWiv · Assembly NetWiv.Core

public sealed class AppHandle : IDisposable
public ImageData DefaultWindowIcon { get; }
public EventBus Events { get; }
public ILoggerFactory LoggerFactory { get; }

The logger factory used by NetWiv and its plugins; a no-op factory when none is configured.

public AppMetadata Metadata { get; }
public ResourceTable Resources { get; }
public IServiceProvider Services { get; }

The application’s root service provider, or an empty provider when none is configured.

public IReadOnlyCollection<WebviewWindow> WebviewWindows { get; }
public IReadOnlyCollection<Webview> Webviews { get; }
public IReadOnlyCollection<Window> Windows { get; }
public FileScope AssetProtocolScope();
public void Dispatch(Action action);
public void Dispose();
public void Emit(string eventName, JsonElement payload, string label = null);
public void Emit(string eventName, JsonElement payload, RuntimeEventTarget target);
public void EmitTo(RuntimeEventTarget target, string eventName, JsonElement payload);
public void EmitTo(string label, string eventName, JsonElement payload);
public void EvaluateScript(string webviewLabel, string script);
public void Exit(int exitCode = 0);
public Task<IReadOnlyList<WebviewWindow>> GetAllWebviewWindowsAsync(CancellationToken cancellationToken = null);

Matches the pinned guest API, which wraps every native window label, including bare windows.

public Task<IReadOnlyList<Webview>> GetAllWebviewsAsync(CancellationToken cancellationToken = null);
public Task<IReadOnlyList<Window>> GetAllWindowsAsync(CancellationToken cancellationToken = null);

Queries live native windows instead of the local lifecycle snapshot.

public Task<Window> GetFocusedWindowAsync(CancellationToken cancellationToken = null);
public Webview GetWebview(string label);

Returns the managed WebView, or null when the label is absent.

public Task<Webview> GetWebviewAsync(string label, CancellationToken cancellationToken = null);
public WebviewWindow GetWebviewWindow(string label);

Returns the managed WebView window, or null when the label is absent or belongs to a bare window.

public Task<WebviewWindow> GetWebviewWindowAsync(string label, CancellationToken cancellationToken = null);
public Window GetWindow(string label);

Returns the managed window, or null when the label is absent.

public Task<Window> GetWindowAsync(string label, CancellationToken cancellationToken = null);
public ValueTask<JsonElement> InvokeAsync(string command, JsonElement args, CancellationToken cancellationToken = null);
public ValueTask<RuntimeInvokeResponse> InvokeResponseAsync(string command, JsonElement args, CancellationToken cancellationToken = null);
public IDisposable Listen(string eventName, Action<AppEvent> handler);
public IDisposable ListenAny(string eventName, Action<AppEvent> handler);
public bool Manage<T>(T value);
public void OnMenuEvent(Action<AppHandle, MenuEvent> handler);
public void OnTrayIconEvent(Action<AppHandle, TrayIconEvent> handler);
public IDisposable Once(string eventName, Action<AppEvent> handler);
public IDisposable OnceAny(string eventName, Action<AppEvent> handler);
public AssetResponse ResolveAsset(AssetRequest request);

Resolves a bundled application asset with the configured response headers and CSP.

public Task<string> ResolveDirectoryAsync(int directory, string path = null, CancellationToken cancellationToken = null);
public void Restart();

Requests exit and relaunch after Run returns and application resources have been disposed.

public State<T> State<T>();
public FileScope TryAssetProtocolScope();
public T TryPlugin<T>();
public State<T>? TryState<T>();
public void Unlisten(long id);
public bool Unmanage<T>(out T value);
public event Action<AppEvent, Exception> EventHandlerFailed;

Reports asynchronous event-handler or follow-up failures. Without a subscriber, failures are written to standard error.