![]() ![]() On Blazor Server, JS interop calls must be asynchronous because they're sent over a network connection. Calls are asynchronous by default to ensure that components are compatible across both Blazor hosting models, Blazor Server and Blazor WebAssembly. JS interop calls are asynchronous by default, regardless of whether the called code is synchronous or asynchronous. In those cases, a warning appears in the text.įor more information, see Call JavaScript functions from. In a few documentation examples, JS interop is used to mutate an element purely for demonstration purposes as part of an example. This guidance not only applies to your own JS interop code but also to any JS libraries that the app uses, including anything provided by a third-party framework, such as Bootstrap JS and jQuery. Undefined behavior may merely interfere with the presentation of elements or their functions but may also introduce security risks to the app or server. If an element rendered by Blazor is modified externally using JS directly or via JS Interop, the DOM may no longer match Blazor's internal representation, which can result in undefined behavior. Blazor maintains representations of the DOM and interacts directly with DOM objects. Only mutate the Document Object Model (DOM) with JavaScript (JS) when the object doesn't interact with Blazor. Interaction with the Document Object Model (DOM) NET methods from JavaScript functions in ASP.NET Core Blazor ![]() These scenarios are called JavaScript interoperability ( JS interop).įurther JS interop guidance is provided in the following articles: A Blazor app can invoke JavaScript (JS) functions from. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |