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

            return(jSObjectReference);
        }
Exemplo 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;
 }
Exemplo 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);
 }
Exemplo 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);
 }
Exemplo n.º 12
0
 public SpaceReference(IJSObjectReference space) : base(space)
 {
 }
Exemplo n.º 13
0
 public WeavyReference(WeavyJsInterop weavyService = null, object options = null, IJSObjectReference weavy = null) : base(weavy)
 {
     Options      = options;
     WeavyService = weavyService;
 }
Exemplo n.º 14
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="js"></param>
 /// <param name="setup"></param>
 public SelectActions(IJSObjectReference js, Settings setup)
 {
     jsRuntime = js;
     Setup     = setup;
 }
Exemplo 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));
        }
Exemplo n.º 16
0
 internal Polyline(IJSObjectReference jsReference, IEventedJsInterop eventedJsInterop)
 {
     EventedJsInterop = eventedJsInterop;
     JsReference      = jsReference;
 }
Exemplo 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));
 }
Exemplo 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"));
 }
Exemplo 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));
 }
Exemplo 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));
 }
Exemplo 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);
            }
        }
Exemplo 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");
        }
Exemplo 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));
    }
Exemplo n.º 28
0
 public JSInvoker(IJSRuntime js, IJSObjectReference jsModule)
 {
     this._JS       = js;
     this._JSModule = jsModule;
 }
Exemplo n.º 29
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="js"></param>
 /// <param name="setup"></param>
 public Commands(IJSObjectReference js, Settings setup)
 {
     jsRuntime = js;
     Setup     = setup;
 }
Exemplo 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();
 }