public SafeCryptoKeyHandle(string name, IJSObjectReference module) : base(IntPtr.Zero, true) { Module = module; Name = name; }
/// <summary> /// Invokes the specified JavaScript function asynchronously. /// </summary> /// <param name="jsObjectReference">The <see cref="IJSObjectReference"/>.</param> /// <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="timeout">The duration after which to cancel the async operation. Overrides default timeouts (<see cref="JSRuntime.DefaultAsyncTimeout"/>).</param> /// <param name="args">JSON-serializable arguments.</param> /// <returns>A <see cref="ValueTask"/> that represents the asynchronous invocation operation.</returns> public static async ValueTask <TValue> InvokeAsync <[DynamicallyAccessedMembers(JsonSerialized)] TValue>(this IJSObjectReference jsObjectReference, string identifier, TimeSpan timeout, params object?[]?args) { if (jsObjectReference is null) { throw new ArgumentNullException(nameof(jsObjectReference)); } using var cancellationTokenSource = timeout == Timeout.InfiniteTimeSpan ? null : new CancellationTokenSource(timeout); var cancellationToken = cancellationTokenSource?.Token ?? CancellationToken.None; return(await jsObjectReference.InvokeAsync <TValue>(identifier, cancellationToken, args)); }
public JsHttpResponseMessage(IJSObjectReference response, CancellationToken cancellationToken) { this.response = response; this.cancellationToken = cancellationToken; }
// Constructed using another IJSObjectReference // Possibility to delay ObjectReference assignment public ExtendableJSObjectReference(IJSObjectReference objectReference = null) { ObjectReference = objectReference; }
public static async Task <IJSObjectReference> RoundTripJSObjectReferenceAsync(IJSObjectReference jSObjectReference) { await Task.Yield(); return(jSObjectReference); }
public bool TryAdd(string name, IJSObjectReference reference) => _references.TryAdd(name, reference);
public JSObjectControlHandle(IJSObjectReference reference) { Object = reference; }
public ExtendableJSObjectReference(IJSObjectReference reference = null) { objectReference = reference; }
/// <summary> /// Constructor /// </summary> /// <param name="js"></param> /// <param name="setup"></param> public InsertActions(IJSObjectReference js, Settings setup) { Setup = setup; Commands = new Commands(js, setup); ObjectConverter = new ObjectConverter(setup); }
public AppReference(IJSObjectReference app) : base(app) { }
protected override async Task OnInitializedAsync() { _typescriptModule = await JSRuntime.InvokeAsync <IJSObjectReference>("import", "./scripts/TypescriptInterop.js").ConfigureAwait(true); }
public SpaceReference(IJSObjectReference space) : base(space) { }
public WeavyReference(WeavyJsInterop weavyService = null, object options = null, IJSObjectReference weavy = null) : base(weavy) { Options = options; WeavyService = weavyService; }
/// <summary> /// Constructor /// </summary> /// <param name="js"></param> /// <param name="setup"></param> public SelectActions(IJSObjectReference js, Settings setup) { jsRuntime = js; Setup = setup; }
public async Task <Circle> Create(LatLng latLng, CircleOptions options) { IJSObjectReference jsReference = await this.jsRuntime.InvokeAsync <IJSObjectReference>(create, latLng, options); return(new Circle(jsReference, this.eventedJsInterop)); }
internal Polyline(IJSObjectReference jsReference, IEventedJsInterop eventedJsInterop) { EventedJsInterop = eventedJsInterop; JsReference = jsReference; }
internal Circle(IJSObjectReference jsReference, IEventedJsInterop eventedJsInterop) : base(jsReference, eventedJsInterop) { }
public static ValueTask <List <DeviceInfo> > GetDeviceInfos(IJSObjectReference module, string listElemIdSuffix = null) { return(module.InvokeAsync <List <DeviceInfo> >( "enumerateMediaDevices", listElemIdSuffix)); }
public bool TryGet(string name, [MaybeNullWhen(false)] out IJSObjectReference reference) => _references.TryGetValue(name, out reference);
public static ValueTask <bool> HasGetUserMedia(IJSObjectReference module) { return(module.InvokeAsync <bool>("hasGetUserMedia")); }
public async Task InitBrowserResizeService() { this.Module = await this.JsRuntime.InvokeAsync <IJSObjectReference>("import", "./_content/BlazorBrowserResize/browserresizejsinterop.js"); this.BrowserResizeMap = await this.Module.InvokeAsync <IJSObjectReference>("initbrowserresize", this.DotNetObjRef); }
public static ValueTask <bool> StartCapture(IJSObjectReference module, string targetVideoElemId, VideoCaptureConstraint constraint) { return(module.InvokeAsync <bool>("startCapture", targetVideoElemId, constraint)); }
public static IJSObjectReference RoundTripJSObjectReference(IJSObjectReference jsObjectReference) { return(jsObjectReference); }
public static ValueTask <bool> StopCapture(IJSObjectReference module, string targetVideoElemId) { return(module.InvokeAsync <bool>("stopCapture", targetVideoElemId)); }
public static async Task <string> InvokeDisposedJSObjectReferenceExceptionAsync(IJSObjectReference jsObjectReference) { try { await jsObjectReference.InvokeVoidAsync("noop"); return("No exception thrown"); } catch (JSException e) { return(e.Message); } }
private async Task CreateJsModule() { JsModule = await JSRuntime.InvokeAsync <IJSObjectReference>("import", "/_content/MoonGrid/moongrid.js"); await JsModule.InvokeVoidAsync("addCss", "/_content/MoonGrid/MoonGrid.bundle.scp.css"); }
/// <summary> /// Invokes the specified JavaScript function asynchronously. /// </summary> /// <typeparam name="TValue">The JSON-serializable return type.</typeparam> /// <param name="jsObjectReference">The <see cref="IJSObjectReference"/>.</param> /// <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="cancellationToken"> /// A cancellation token to signal the cancellation of the operation. Specifying this parameter will override any default cancellations such as due to timeouts /// (<see cref="JSRuntime.DefaultAsyncTimeout"/>) from being applied. /// </param> /// <param name="args">JSON-serializable arguments.</param> /// <returns>An instance of <typeparamref name="TValue"/> obtained by JSON-deserializing the return value.</returns> public static ValueTask <TValue> InvokeAsync <[DynamicallyAccessedMembers(JsonSerialized)] TValue>(this IJSObjectReference jsObjectReference, string identifier, CancellationToken cancellationToken, params object?[]?args) { if (jsObjectReference is null) { throw new ArgumentNullException(nameof(jsObjectReference)); } return(jsObjectReference.InvokeAsync <TValue>(identifier, cancellationToken, args)); }
public JSInvoker(IJSRuntime js, IJSObjectReference jsModule) { this._JS = js; this._JSModule = jsModule; }
/// <summary> /// Constructor /// </summary> /// <param name="js"></param> /// <param name="setup"></param> public Commands(IJSObjectReference js, Settings setup) { jsRuntime = js; Setup = setup; }
protected override async Task OnInitializedAsync() { Theme = (await UserSettingsService.GetAsync()).Theme; _jsModule = await JSRuntime.InvokeAsync <IJSObjectReference>("import", $"./Layouts/Main/{nameof(SiteHeader)}.razor.js"); await UpdateStyleAsync(); }