Add InvokeAsync with cancellation token overload to IJSRuntime (dotnet/extensions#1915)
Adds the InvokeAsync with cancellation token overload to IJSRuntime\n\nCommit migrated from 55f0b77464
This commit is contained in:
parent
5e4f1f5fb2
commit
6069a89758
|
|
@ -32,6 +32,7 @@ namespace Microsoft.JSInterop
|
||||||
}
|
}
|
||||||
public partial interface IJSRuntime
|
public partial interface IJSRuntime
|
||||||
{
|
{
|
||||||
|
System.Threading.Tasks.Task<TValue> InvokeAsync<TValue>(string identifier, System.Collections.Generic.IEnumerable<object> args, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
|
||||||
System.Threading.Tasks.Task<TValue> InvokeAsync<TValue>(string identifier, params object[] args);
|
System.Threading.Tasks.Task<TValue> InvokeAsync<TValue>(string identifier, params object[] args);
|
||||||
}
|
}
|
||||||
public partial class JSException : System.Exception
|
public partial class JSException : System.Exception
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System.Collections.Generic;
|
||||||
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Microsoft.JSInterop
|
namespace Microsoft.JSInterop
|
||||||
|
|
@ -19,5 +20,15 @@ namespace Microsoft.JSInterop
|
||||||
/// <param name="args">JSON-serializable arguments.</param>
|
/// <param name="args">JSON-serializable arguments.</param>
|
||||||
/// <returns>An instance of <typeparamref name="TValue"/> obtained by JSON-deserializing the return value.</returns>
|
/// <returns>An instance of <typeparamref name="TValue"/> obtained by JSON-deserializing the return value.</returns>
|
||||||
Task<TValue> InvokeAsync<TValue>(string identifier, params object[] args);
|
Task<TValue> InvokeAsync<TValue>(string identifier, params object[] args);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Invokes the specified JavaScript function asynchronously.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TValue">The JSON-serializable return type.</typeparam>
|
||||||
|
/// <param name="identifier">An identifier for the function to invoke. For example, the value <code>"someScope.someFunction"</code> will invoke the function <code>window.someScope.someFunction</code>.</param>
|
||||||
|
/// <param name="args">JSON-serializable arguments.</param>
|
||||||
|
/// <param name="cancellationToken">A cancellation token to signal the cancellation of the operation.</param>
|
||||||
|
/// <returns>An instance of <typeparamref name="TValue"/> obtained by JSON-deserializing the return value.</returns>
|
||||||
|
Task<TValue> InvokeAsync<TValue>(string identifier, IEnumerable<object> args, CancellationToken cancellationToken = default);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,9 @@
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
|
|
@ -29,6 +31,9 @@ namespace Microsoft.JSInterop.Tests
|
||||||
{
|
{
|
||||||
public Task<T> InvokeAsync<T>(string identifier, params object[] args)
|
public Task<T> InvokeAsync<T>(string identifier, params object[] args)
|
||||||
=> throw new NotImplementedException();
|
=> throw new NotImplementedException();
|
||||||
|
|
||||||
|
public Task<TValue> InvokeAsync<TValue>(string identifier, IEnumerable<object> args, CancellationToken cancellationToken = default) =>
|
||||||
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue