コード例 #1
0
ファイル: JSWindow.cs プロジェクト: lanicon/CosyNest
 public ValueTask <bool> Confirm(string message)
 => JSRuntime.InvokeAsync <bool>("confirm", message);
コード例 #2
0
        /// <summary>
        /// Invokes the specified JavaScript function asynchronously.
        /// <para>
        /// <see cref="JSRuntime"/> will apply timeouts to this operation based on the value configured in <see cref="JSRuntime.DefaultAsyncTimeout"/>. To dispatch a call with a different, or no timeout,
        /// consider using <see cref="InvokeAsync{TValue}(string, CancellationToken, object[])" />.
        /// </para>
        /// </summary>
        /// <typeparam name="TValue">The JSON-serializable return type.</typeparam>
        /// <param name="identifier">An identifier for the function to invoke. For example, the value <c>"someScope.someFunction"</c> will invoke the function <c>someScope.someFunction</c> on the target instance.</param>
        /// <param name="args">JSON-serializable arguments.</param>
        /// <returns>An instance of <typeparamref name="TValue"/> obtained by JSON-deserializing the return value.</returns>
        public ValueTask <TValue> InvokeAsync <TValue>(string identifier, params object[] args)
        {
            ThrowIfDisposed();

            return(_jsRuntime.InvokeAsync <TValue>(Id, identifier, args));
        }
コード例 #3
0
ファイル: JSLocalStorage.cs プロジェクト: lanicon/CosyNest
        public async Task <(bool Exist, string?Value)> TryGetValueAsync(string key)
        {
            var value = await JSRuntime.InvokeAsync <string?>("localStorage.getItem", key);

            return(value is { }, value);