This is a migrated thread and some comments may be shown as answers.

Does not show after calling JSRuntime.Invoke

2 Answers 59 Views
AnimationContainer
This is a migrated thread and some comments may be shown as answers.
Jonathan
Top achievements
Rank 1
Veteran
Jonathan asked on 11 May 2020, 05:19 PM

Hi..

I have the following code.  

After JSRuntime is called the AnimationContainer does not show. I get a screen flicker.

Any idea how I can show the Animation Container after opening (downloading a file)

thanks again!

 

        await JSRuntime.InvokeAsync<object>("open", URI, "_blank");

                 
        await AnimationContainer.ShowAsync();
        StateHasChanged();

        await Task.Delay(5000);

        await AnimationContainer.HideAsync();
        StateHasChanged();

2 Answers, 1 is accepted

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 11 May 2020, 05:46 PM

Hello Jonathan,

The provided code snippet throws an error in the window.open call, which breaks the entire app. I am attaching a short video that demonstrates this. I strongly advise that you monitor the browser console to ensure there are no errors. Blazor cannot take circular JS object references, and the window object returned from window.open has a circular reference - its .parent field points to the current window instance.

A workaround for that can be defining you own function that does not create a circular reference because it will never serialize a return type back to Blazor. For your convenience, I am attaching a sample of this.

 

Regards,
Marin Bratanov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Jonathan
Top achievements
Rank 1
Veteran
answered on 11 May 2020, 07:30 PM
Awesome!.. thx again
Tags
AnimationContainer
Asked by
Jonathan
Top achievements
Rank 1
Veteran
Answers by
Marin Bratanov
Telerik team
Jonathan
Top achievements
Rank 1
Veteran
Share this question
or