Esempio n. 1
0
 public SafeCryptoKeyHandle(string name, IJSObjectReference module)
     : base(IntPtr.Zero, true)
 {
     Module = module;
     Name   = name;
 }
Esempio n. 2
0
    /// <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;
 }
Esempio n. 5
0
        public static async Task <IJSObjectReference> RoundTripJSObjectReferenceAsync(IJSObjectReference jSObjectReference)
        {
            await Task.Yield();

            return(jSObjectReference);
        }
Esempio n. 6
0
 public bool TryAdd(string name, IJSObjectReference reference)
 => _references.TryAdd(name, reference);
 public JSObjectControlHandle(IJSObjectReference reference)
 {
     Object = reference;
 }
 public ExtendableJSObjectReference(IJSObjectReference reference = null)
 {
     objectReference = reference;
 }
Esempio n. 9
0
 /// <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);
 }
Esempio n. 10
0
 public AppReference(IJSObjectReference app) : base(app)
 {
 }
 protected override async Task OnInitializedAsync()
 {
     _typescriptModule = await JSRuntime.InvokeAsync <IJSObjectReference>("import", "./scripts/TypescriptInterop.js").ConfigureAwait(true);
 }
Esempio n. 12
0
 public SpaceReference(IJSObjectReference space) : base(space)
 {
 }
Esempio n. 13
0
 public WeavyReference(WeavyJsInterop weavyService = null, object options = null, IJSObjectReference weavy = null) : base(weavy)
 {
     Options      = options;
     WeavyService = weavyService;
 }
Esempio n. 14
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="js"></param>
 /// <param name="setup"></param>
 public SelectActions(IJSObjectReference js, Settings setup)
 {
     jsRuntime = js;
     Setup     = setup;
 }
Esempio n. 15
0
        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));
        }
Esempio n. 16
0
 internal Polyline(IJSObjectReference jsReference, IEventedJsInterop eventedJsInterop)
 {
     EventedJsInterop = eventedJsInterop;
     JsReference      = jsReference;
 }
Esempio n. 17
0
 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));
 }
Esempio n. 19
0
 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"));
 }
Esempio n. 21
0
        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));
 }
Esempio n. 23
0
 public static IJSObjectReference RoundTripJSObjectReference(IJSObjectReference jsObjectReference)
 {
     return(jsObjectReference);
 }
 public static ValueTask <bool> StopCapture(IJSObjectReference module, string targetVideoElemId)
 {
     return(module.InvokeAsync <bool>("stopCapture", targetVideoElemId));
 }
Esempio n. 25
0
        public static async Task <string> InvokeDisposedJSObjectReferenceExceptionAsync(IJSObjectReference jsObjectReference)
        {
            try
            {
                await jsObjectReference.InvokeVoidAsync("noop");

                return("No exception thrown");
            }
            catch (JSException e)
            {
                return(e.Message);
            }
        }
Esempio n. 26
0
        private async Task CreateJsModule()
        {
            JsModule = await JSRuntime.InvokeAsync <IJSObjectReference>("import", "/_content/MoonGrid/moongrid.js");

            await JsModule.InvokeVoidAsync("addCss", "/_content/MoonGrid/MoonGrid.bundle.scp.css");
        }
Esempio n. 27
0
    /// <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));
    }
Esempio n. 28
0
 public JSInvoker(IJSRuntime js, IJSObjectReference jsModule)
 {
     this._JS       = js;
     this._JSModule = jsModule;
 }
Esempio n. 29
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="js"></param>
 /// <param name="setup"></param>
 public Commands(IJSObjectReference js, Settings setup)
 {
     jsRuntime = js;
     Setup     = setup;
 }
Esempio n. 30
0
 protected override async Task OnInitializedAsync()
 {
     Theme     = (await UserSettingsService.GetAsync()).Theme;
     _jsModule = await JSRuntime.InvokeAsync <IJSObjectReference>("import", $"./Layouts/Main/{nameof(SiteHeader)}.razor.js");
     await UpdateStyleAsync();
 }