From the course: Blazor: Getting Started
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Call Blazor from JavaScript - Blazor Tutorial
From the course: Blazor: Getting Started
Call Blazor from JavaScript
- [Narrator] Since the beam animation is so mesmerizing, I want the application to let the user know how many times they've watched the beam go by, we can have JavaScript call back to our application to register each time the animation completes. Because of the nature of JavaScript calling into the dotnet runtime from a dynamically typed language to a statically typed one, there are some restrictions, the method must either be static, or pass a reference of itself into JavaScript. There isn't a way for blazer to find a particular instance of a class to execute a method if we don't send it one. And if we do send it a reference to call, we have to ensure that it's disposed of properly. The method can't use generic arguments overloads or interface types, because the types of the arguments are used to deserialize the incoming data, which brings us to the last restriction. The parameters have to be deserializable from JSON…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
Call JavaScript from Blazor6m 37s
-
(Locked)
Call Blazor from JavaScript4m 20s
-
(Locked)
ElementReferences in JavaScript with Blazor6m 23s
-
(Locked)
Unit test JavaScript5m 55s
-
(Locked)
Challenge: Make an interesting call to JavaScript1m 34s
-
(Locked)
Solution: Make an interesting call to JavaScript1m 36s
-
-
-