Questions tagged [javascript-interop]
16 questions
24
votes
4 answers
How to do client-side UI events in Blazor
I just started playing around with Blazor and I can already see the great potential of this new framework.
I'm wondering, though, how it will handle doing simple things like setting focus on an input control? For instance, after I handle a click…

camainc
- 3,750
- 7
- 35
- 46
4
votes
1 answer
Port React app to Blazor app with JavaScript library imported using JavaScript interop
I currently have a React app that I'm trying to convert to a Blazor WebAssembly app. The React app has a component that imports a JavaScript library, the sample code for which can be seen here. The imported charting_library code itself isn't…

Neo
- 4,145
- 6
- 53
- 76
2
votes
1 answer
createObjectURL giving not enough arguments
I want to get the url of a blob, and I'm doing the following:
(.. js/window -URL createObjectURL blob)
to mimic the JS
window.URL.createObjectURL(blob)
But I get the following error:
TypeError: Not enough arguments (at createObjectURL)
What am I…

zengod
- 1,114
- 13
- 26
1
vote
1 answer
Need C# JSImport async signature interop example to match async Javascript method - Blazor
In Blazor, Core 7, I don't know how to create a JSImport signature to match an async javascript method. Here's an example of the Javascript method:
export async function DoSomething(data)
{
// do work
return result
}
the following C#…

Sean
- 2,531
- 2
- 17
- 17
1
vote
1 answer
Blazor server Javascript Websocket callback to c# injected service does not work
I have a blazor server app, that calls an injected service to call a web socket in javascript to get some data. I want the web socket to return the data to a c# instance callback on the service. The c# callback works fine from the javascript…

LostException
- 77
- 9
1
vote
1 answer
Blazor Server Side, call JavaScript function that resides in a CDN from a .razor page when it renders
I'm trying to include Bootstrap for Material Design into my Blazor Server Side project. I have it working perfectly in a plain HTML file, but the issue with Blazor comes with a script. which I assume needs to run after a page was rendered. The…

Riaan V
- 265
- 1
- 2
- 7
1
vote
1 answer
Blazor javascript method cannot be called
I am trying to call a javascript function from my Blazor component using JSinterop but I always get this error :
"Uncaught SyntaxError: Unexpected end of input".
Plus the javascript function is being called automatically when the page is fully…

Haytham
- 834
- 1
- 12
- 31
0
votes
1 answer
Blazor WASM JavaScript Interop Function Not Defined/Found
I'm messing around with the default Blazor WASM scaffolded application from Visual Studio 2022 (.NET 6).
Specifically just trying to call a JS function (that's in its own file) from a method in one of the components.
Is there a specific place to put…

netdev19
- 51
- 1
- 5
0
votes
1 answer
MemoryView utilization with latest JSImport API syntax to interop with Javascript - Blazor
As a corollary to Need C# JSImport async signature interop example to match async Javascript method - Blazor
I'd like to find a Span/ArraySegment solution to passing and receiving parameters via javascript interop in Blazor.
Here's my best attempt…

Sean
- 2,531
- 2
- 17
- 17
0
votes
2 answers
Why might OnAfterRender not fire?
Similar to this question from two years ago, I have a Blazor server-side app and the OnAfterRender() method isn't firing. If I set a breakpoint at the start of the method, the breakpoint isn't hit.
I created a minimal example page in my…

mdirks
- 23
- 5
0
votes
1 answer
Blazor Unmarshalled JavaScript interop
To improve performance in Blazor JS Interop calls, synchronous and unmarshalled apis are available
I struggle to find more information regarding the unmarshalled.
For example:
//javascript
JSFunctions.f1 = function (fields) {
var f1 =…

Franco Tiveron
- 2,364
- 18
- 34
0
votes
1 answer
Blazor server JavaScript invoke data transmission
Thankfully, we can easily call JavaScript functions from our Blazor server's C# code, see this MSDN page. The JavaScript code will be running on the client's browser and the C# code on the server, and Blazor's SignalR connection lies between these…

Amir Mahdi Nassiri
- 1,190
- 13
- 21
0
votes
0 answers
How to properly check asserts you do with type system of TS against vanilla JS?
I'm creating a TS wrapper over a JS embedded to third-party software API which is unmanaged by me. I want to capture as much behavior as even possible in types and interfaces because untyped vanilla JS is pretty hard to get it working in my…

Iva Kam
- 932
- 4
- 13
0
votes
1 answer
Javascript Interop Dispose Problem with blazor serverside
When ever refresh or manually navigate to a Blazor page that is using javascript interop, it errors out because the dispose function no longer exists in javascript.
Is there a way to not run "dispose" on a component that implements IDisposable when…

Tom Crosman
- 1,137
- 1
- 12
- 37
0
votes
1 answer
Blazor WebAssembly and LocalStorage JSInterop Error
Good Day,
I have a Blazor WASM application that will call a third party API to get data for a page. This API requires a jwt token, which I have retrieved after the login and stored in LocalStorage.
When I make the 3rd Party API call, I attempt to…

trevoirwilliams
- 459
- 7
- 20