Soenneker.Blazor.Utils.ResourceLoader 2.1.337

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Soenneker.Blazor.Utils.ResourceLoader --version 2.1.337                
NuGet\Install-Package Soenneker.Blazor.Utils.ResourceLoader -Version 2.1.337                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Soenneker.Blazor.Utils.ResourceLoader" Version="2.1.337" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Soenneker.Blazor.Utils.ResourceLoader --version 2.1.337                
#r "nuget: Soenneker.Blazor.Utils.ResourceLoader, 2.1.337"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Soenneker.Blazor.Utils.ResourceLoader as a Cake Addin
#addin nuget:?package=Soenneker.Blazor.Utils.ResourceLoader&version=2.1.337

// Install Soenneker.Blazor.Utils.ResourceLoader as a Cake Tool
#tool nuget:?package=Soenneker.Blazor.Utils.ResourceLoader&version=2.1.337                

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

alternate text is missing from this package README image Soenneker.Blazor.Utils.ResourceLoader

A Blazor JavaScript interop for dynamically loading scripts, styles, and modules

Overview

The ResourceLoader class is designed to manage the loading and initialization of scripts, styles, and JavaScript modules in a Blazor application. It provides methods to asynchronously load scripts and styles, wait for variables to be available, and manage the lifecycle of JavaScript modules.

It ensures that each resource is only loaded once (through this interop), even with multiple concurrent calls.

Table of Contents

Installation

dotnet add package Soenneker.Blazor.Utils.ResourceLoader

Usage

Loading Scripts

To load a script, use the LoadScript method. It injects the file into the DOM.

await resourceLoader.LoadScript("https://example.com/script.js");

LoadScriptAndWaitForVariable is also available. It waits for a specified JavaScript variable to be available:

await resourceLoader.LoadScriptAndWaitForVariable("https://example.com/script.js", "variableName");

Loading Styles

To load a style, use the LoadStyle method. It injects the file into the DOM.

await resourceLoader.LoadStyle("https://example.com/style.css");

Importing Modules

To import a JavaScript module, use the ImportModule method:

var module = await resourceLoader.ImportModule("moduleName");

You probably want ImportModuleAndWaitUntilAvailable, as that waits until the module is loaded, and accessible:

// 'ResourceLoader' is the name of the export class
var module = await resourceLoader.ImportModuleAndWaitUntilAvailable("Soenneker.Blazor.Utils.ResourceLoader/resourceloader.js", "ResourceLoader");

Waiting for Variables

To wait for a JavaScript variable to be available, use the WaitForVariable method:

await resourceLoader.WaitForVariable("variableName");

Disposing Modules

Be sure to dispose of a module after you're done interacting with it. To dispose of a JavaScript module, use the DisposeModule method:

await resourceLoader.DisposeModule("moduleName");
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (10)

Showing the top 5 NuGet packages that depend on Soenneker.Blazor.Utils.ResourceLoader:

Package Downloads
Soenneker.Blazor.TomSelect

A Blazor interop library for the select user control library, Tom Select

Soenneker.Blazor.FilePond

A Blazor interop library for the file upload library FilePond

Soenneker.Blazor.Clarity

A small Blazor interop library that sets up Microsoft Clarity

Soenneker.Blazor.Masonry

A Blazor interop library that integrates Masonry, the cascading grid layout library

Soenneker.Blazor.LogJson

A Blazor interop library that logs JSON (like HTTP requests/responses) within the browser

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.1.540 0 11/9/2024
2.1.539 0 11/9/2024
2.1.538 7 11/9/2024
2.1.537 6 11/9/2024
2.1.536 77 11/9/2024
2.1.535 20 11/9/2024
2.1.534 175 11/8/2024
2.1.533 26 11/8/2024
2.1.532 123 11/8/2024
2.1.531 76 11/8/2024
2.1.530 27 11/8/2024
2.1.529 126 11/8/2024
2.1.528 28 11/8/2024
2.1.527 242 11/8/2024
2.1.526 176 11/8/2024
2.1.525 32 11/8/2024
2.1.524 73 11/8/2024
2.1.523 344 11/6/2024
2.1.522 161 11/6/2024
2.1.521 487 11/1/2024
2.1.520 282 11/1/2024
2.1.519 233 11/1/2024
2.1.518 61 11/1/2024
2.1.517 361 11/1/2024
2.1.516 61 11/1/2024
2.1.515 241 11/1/2024
2.1.514 581 10/29/2024
2.1.513 147 10/29/2024
2.1.512 136 10/29/2024
2.1.511 68 10/29/2024
2.1.510 57 10/29/2024
2.1.509 455 10/29/2024
2.1.508 256 10/29/2024
2.1.507 62 10/29/2024
2.1.506 365 10/29/2024
2.1.505 62 10/29/2024
2.1.504 64 10/29/2024
2.1.503 208 10/29/2024
2.1.502 61 10/29/2024
2.1.501 620 10/29/2024
2.1.500 479 10/29/2024
2.1.499 64 10/29/2024
2.1.498 523 10/28/2024
2.1.497 59 10/28/2024
2.1.496 707 10/26/2024
2.1.495 132 10/26/2024
2.1.494 181 10/26/2024
2.1.493 67 10/26/2024
2.1.492 905 10/22/2024
2.1.491 235 10/22/2024
2.1.490 63 10/22/2024
2.1.489 286 10/22/2024
2.1.488 63 10/22/2024
2.1.487 466 10/22/2024
2.1.486 87 10/22/2024
2.1.485 399 10/22/2024
2.1.484 56 10/22/2024
2.1.483 474 10/22/2024
2.1.482 948 10/18/2024
2.1.481 380 10/17/2024
2.1.480 72 10/17/2024
2.1.479 305 10/17/2024
2.1.478 69 10/17/2024
2.1.477 988 10/15/2024
2.1.476 222 10/15/2024
2.1.475 312 10/15/2024
2.1.474 67 10/15/2024
2.1.473 562 10/14/2024
2.1.472 503 10/12/2024
2.1.471 165 10/12/2024
2.1.470 194 10/12/2024
2.1.469 73 10/12/2024
2.1.468 267 10/12/2024
2.1.467 84 10/12/2024
2.1.466 365 10/11/2024
2.1.465 69 10/11/2024
2.1.464 342 10/11/2024
2.1.463 73 10/11/2024
2.1.462 672 10/9/2024
2.1.461 164 10/9/2024
2.1.460 155 10/9/2024
2.1.459 73 10/9/2024
2.1.458 367 10/9/2024
2.1.457 74 10/9/2024
2.1.456 299 10/9/2024
2.1.455 73 10/9/2024
2.1.454 143 10/9/2024
2.1.453 178 10/9/2024
2.1.452 76 10/9/2024
2.1.451 522 10/8/2024
2.1.450 76 10/8/2024
2.1.449 496 10/8/2024
2.1.448 212 10/8/2024
2.1.447 75 10/8/2024
2.1.446 378 10/8/2024
2.1.445 82 10/8/2024
2.1.444 232 10/8/2024
2.1.443 113 10/8/2024
2.1.442 74 10/8/2024
2.1.441 502 10/8/2024
2.1.440 67 10/8/2024
2.1.439 579 10/3/2024
2.1.438 148 10/3/2024
2.1.437 265 10/3/2024
2.1.436 78 10/3/2024
2.1.435 269 10/3/2024
2.1.434 246 10/3/2024
2.1.433 77 10/3/2024
2.1.432 164 10/3/2024
2.1.431 168 10/3/2024
2.1.430 71 10/3/2024
2.1.429 327 10/3/2024
2.1.428 629 10/2/2024
2.1.427 91 10/2/2024
2.1.426 161 10/2/2024
2.1.425 76 10/2/2024
2.1.424 167 10/2/2024
2.1.423 249 10/2/2024
2.1.422 175 10/2/2024
2.1.421 90 10/2/2024
2.1.420 310 10/2/2024
2.1.419 75 10/2/2024
2.1.418 489 10/2/2024
2.1.417 83 10/2/2024
2.1.416 236 10/1/2024
2.1.415 394 10/1/2024
2.1.414 78 10/1/2024
2.1.413 176 10/1/2024
2.1.412 78 10/1/2024
2.1.411 371 10/1/2024
2.1.410 92 10/1/2024
2.1.409 373 10/1/2024
2.1.408 72 10/1/2024
2.1.407 433 9/29/2024
2.1.406 201 9/29/2024
2.1.405 130 9/29/2024
2.1.404 227 9/29/2024
2.1.403 74 9/29/2024
2.1.402 211 9/29/2024
2.1.401 210 9/29/2024
2.1.400 69 9/29/2024
2.1.399 349 9/29/2024
2.1.398 76 9/29/2024
2.1.397 516 9/27/2024
2.1.396 203 9/27/2024
2.1.395 221 9/27/2024
2.1.394 75 9/27/2024
2.1.393 183 9/27/2024
2.1.392 74 9/27/2024
2.1.391 329 9/27/2024
2.1.390 215 9/27/2024
2.1.389 72 9/27/2024
2.1.388 441 9/27/2024
2.1.387 81 9/27/2024
2.1.386 203 9/27/2024
2.1.385 137 9/27/2024
2.1.384 78 9/27/2024
2.1.383 506 9/27/2024
2.1.382 170 9/27/2024
2.1.381 197 9/26/2024
2.1.380 87 9/26/2024
2.1.379 245 9/26/2024
2.1.378 238 9/26/2024
2.1.377 86 9/26/2024
2.1.376 325 9/26/2024
2.1.375 161 9/26/2024
2.1.374 158 9/26/2024
2.1.373 91 9/26/2024
2.1.372 435 9/26/2024
2.1.371 82 9/26/2024
2.1.370 241 9/26/2024
2.1.369 239 9/26/2024
2.1.368 158 9/26/2024
2.1.367 150 9/26/2024
2.1.366 81 9/26/2024
2.1.365 200 9/26/2024
2.1.364 642 9/24/2024
2.1.363 176 9/23/2024
2.1.362 95 9/23/2024
2.1.361 61 9/23/2024
2.1.360 171 9/23/2024
2.1.359 194 9/23/2024
2.1.358 63 9/23/2024
2.1.357 251 9/23/2024
2.1.356 177 9/23/2024
2.1.355 73 9/23/2024
2.1.354 159 9/23/2024
2.1.353 433 9/23/2024
2.1.352 58 9/23/2024
2.1.351 70 9/23/2024
2.1.350 435 9/23/2024
2.1.349 72 9/23/2024
2.1.348 234 9/23/2024
2.1.347 154 9/23/2024
2.1.346 400 9/23/2024
2.1.345 71 9/23/2024
2.1.344 110 9/23/2024
2.1.343 341 9/23/2024
2.1.342 78 9/23/2024
2.1.341 197 9/23/2024
2.1.340 70 9/23/2024
2.1.339 146 9/23/2024
2.1.338 54 9/23/2024
2.1.337 754 9/18/2024
2.1.336 61 9/18/2024
2.1.335 183 9/18/2024
2.1.334 143 9/18/2024
2.1.333 69 9/18/2024
2.1.332 288 9/18/2024
2.1.331 236 9/18/2024
2.1.330 79 9/18/2024
2.1.329 204 9/18/2024
2.1.328 91 9/18/2024
2.1.327 224 9/18/2024
2.1.326 86 9/18/2024
2.1.325 115 9/17/2024
2.1.324 94 9/17/2024
2.1.323 88 9/17/2024
2.1.322 183 9/17/2024
2.1.321 210 9/17/2024
2.1.320 73 9/17/2024
2.1.319 227 9/17/2024
2.1.318 94 9/17/2024
2.1.317 88 9/17/2024
2.1.316 227 9/17/2024
2.1.315 97 9/17/2024
2.1.314 254 9/17/2024
2.1.313 87 9/17/2024
2.1.312 238 9/17/2024
2.1.311 87 9/17/2024
2.1.310 252 9/17/2024
2.1.309 150 9/17/2024
2.1.308 169 9/17/2024
2.1.307 539 9/17/2024
2.1.306 96 9/17/2024
2.1.305 327 9/16/2024
2.1.304 255 9/16/2024
2.1.303 191 9/16/2024
2.1.302 181 9/16/2024
2.1.301 80 9/16/2024
2.1.300 222 9/16/2024
2.1.299 825 9/12/2024
2.1.298 213 9/12/2024
2.1.297 92 9/12/2024
2.1.296 247 9/12/2024
2.1.295 84 9/12/2024
2.1.294 340 9/12/2024
2.1.293 96 9/12/2024
2.1.292 221 9/12/2024
2.1.291 221 9/12/2024
2.1.290 111 9/12/2024
2.1.289 259 9/12/2024
2.1.288 106 9/12/2024
2.1.287 229 9/11/2024
2.1.286 90 9/11/2024
2.1.285 199 9/11/2024
2.1.284 99 9/11/2024
2.1.282 421 9/11/2024
2.1.281 100 9/11/2024
2.1.280 325 9/11/2024
2.1.279 100 9/11/2024
2.1.278 357 9/11/2024
2.1.277 353 9/11/2024
2.1.276 95 9/11/2024
2.1.275 231 9/11/2024
2.1.274 528 9/11/2024
2.1.273 186 9/10/2024
2.1.272 89 9/10/2024
2.1.271 195 9/10/2024
2.1.270 422 9/10/2024
2.1.269 117 9/10/2024
2.1.268 232 9/10/2024
2.1.267 93 9/10/2024
2.1.266 333 9/10/2024
2.1.265 273 9/10/2024
2.1.263 320 9/10/2024
2.1.262 153 9/10/2024
2.1.261 94 9/9/2024
2.1.260 339 9/9/2024
2.1.259 280 9/9/2024
2.1.258 270 9/9/2024
2.1.257 384 9/9/2024
2.1.255 255 9/9/2024
2.1.254 85 9/9/2024
2.1.253 254 9/9/2024
2.1.252 77 9/9/2024
2.1.251 664 9/7/2024
2.1.250 289 9/7/2024
2.1.249 98 9/7/2024
2.1.248 96 9/7/2024
2.1.247 285 9/7/2024
2.1.246 75 9/7/2024
2.1.245 362 9/6/2024
2.1.244 150 9/6/2024
2.1.243 94 9/6/2024
2.1.242 263 9/6/2024
2.1.241 97 9/6/2024
2.1.240 355 9/6/2024
2.1.239 124 9/6/2024
2.1.238 174 9/6/2024
2.1.237 91 9/6/2024
2.1.236 380 9/5/2024
2.1.235 115 9/5/2024
2.1.234 90 9/5/2024
2.1.233 203 9/5/2024
2.1.232 74 9/5/2024
2.1.231 323 9/5/2024
2.1.230 78 9/5/2024
2.1.229 193 9/5/2024
2.1.228 98 9/5/2024
2.1.227 97 9/5/2024
2.1.226 640 9/5/2024
2.1.225 93 9/5/2024
2.1.224 178 9/5/2024
2.1.223 90 9/5/2024
2.1.222 670 9/4/2024
2.1.221 93 9/4/2024
2.1.220 340 9/4/2024
2.1.219 213 9/4/2024
2.1.218 105 9/4/2024
2.1.217 153 9/4/2024
2.1.216 179 9/3/2024
2.1.215 94 9/3/2024
2.1.214 286 9/3/2024
2.1.213 70 9/3/2024
2.1.212 283 9/3/2024
2.1.211 98 9/3/2024
2.1.210 300 9/3/2024
2.1.209 82 9/3/2024
2.1.207 329 9/3/2024
2.1.206 626 8/29/2024
2.1.205 89 8/29/2024
2.1.204 176 8/29/2024
2.1.203 88 8/29/2024
2.1.202 306 8/29/2024
2.1.201 464 8/26/2024
2.1.200 183 8/26/2024
2.1.199 199 8/26/2024
2.1.197 149 8/26/2024
2.1.196 436 8/26/2024
2.1.195 101 8/26/2024
2.1.194 395 8/21/2024
2.1.193 209 8/21/2024
2.1.192 115 8/21/2024
2.1.191 276 8/21/2024
2.1.190 111 8/21/2024
2.1.189 327 8/21/2024
2.1.188 96 8/21/2024
2.1.187 264 8/21/2024
2.1.186 91 8/21/2024
2.1.185 331 8/20/2024
2.1.184 100 8/20/2024
2.1.183 355 8/20/2024
2.1.182 110 8/20/2024
2.1.181 331 8/20/2024
2.1.180 96 8/20/2024
2.1.179 267 8/20/2024
2.1.178 435 8/20/2024
2.1.177 211 8/19/2024
2.1.176 100 8/19/2024
2.1.175 404 8/15/2024
2.1.174 167 8/15/2024
2.1.173 160 8/15/2024
2.1.172 105 8/15/2024
2.1.171 197 8/15/2024
2.1.170 173 8/15/2024
2.1.169 252 8/15/2024
2.1.168 86 8/15/2024
2.1.167 328 8/15/2024
2.1.166 405 8/14/2024
2.1.165 253 8/14/2024
2.1.164 110 8/14/2024
2.1.163 222 8/14/2024
2.1.162 102 8/14/2024
2.1.161 208 8/13/2024
2.1.160 371 8/13/2024
2.1.159 425 8/7/2024
2.1.158 170 8/7/2024
2.1.157 146 8/7/2024
2.1.156 167 8/7/2024
2.1.155 76 8/7/2024
2.1.154 195 8/7/2024
2.1.153 67 8/7/2024
2.1.152 191 8/6/2024
2.1.151 80 8/6/2024
2.1.150 167 8/6/2024
2.1.149 556 8/1/2024
2.1.148 219 8/1/2024
2.1.147 84 8/1/2024
2.1.146 192 8/1/2024
2.1.145 78 8/1/2024
2.1.144 139 8/1/2024
2.1.143 87 8/1/2024
2.1.142 273 8/1/2024
2.1.141 91 8/1/2024
2.1.140 102 8/1/2024
2.1.139 81 8/1/2024
2.1.138 157 8/1/2024
2.1.137 509 7/25/2024
2.1.136 208 7/25/2024
2.1.135 102 7/25/2024
2.1.134 115 7/25/2024
2.1.133 134 7/25/2024
2.1.132 51 7/25/2024
2.1.131 148 7/25/2024
2.1.130 61 7/25/2024
2.1.129 119 7/25/2024
2.1.128 62 7/25/2024
2.1.127 146 7/25/2024
2.1.126 100 7/25/2024
2.1.125 63 7/25/2024
2.1.124 151 7/25/2024
2.1.123 146 7/25/2024
2.1.122 52 7/25/2024
2.1.121 149 7/24/2024
2.1.120 134 7/24/2024
2.1.119 130 7/24/2024
2.1.118 924 7/20/2024
2.1.117 129 7/20/2024
2.1.116 100 7/20/2024
2.1.115 98 7/20/2024
2.1.114 95 7/20/2024
2.1.113 160 7/20/2024
2.1.112 92 7/20/2024
2.1.111 170 7/20/2024
2.1.110 533 7/17/2024
2.1.109 156 7/17/2024
2.1.108 134 7/17/2024
2.1.107 257 7/14/2024
2.1.106 83 7/14/2024
2.1.105 215 7/14/2024
2.1.104 225 7/14/2024
2.1.103 82 7/14/2024
2.1.102 85 7/14/2024
2.1.101 303 7/14/2024
2.1.100 87 7/14/2024
2.1.99 212 7/14/2024
2.1.98 377 7/11/2024
2.1.97 211 7/10/2024
2.1.96 109 7/10/2024
2.1.95 262 7/10/2024
2.1.94 318 7/10/2024
2.1.93 92 7/10/2024
2.1.92 110 7/10/2024
2.1.91 139 7/10/2024
2.1.90 159 7/10/2024
2.1.89 129 7/10/2024
2.1.88 72 7/10/2024
2.1.87 169 7/10/2024
2.1.86 64 7/10/2024
2.1.85 143 7/10/2024
2.1.84 80 7/10/2024
2.1.83 116 7/10/2024
2.1.82 82 7/10/2024
2.1.81 126 7/10/2024
2.1.80 87 7/10/2024
2.1.79 167 7/10/2024
2.1.78 90 7/10/2024
2.1.77 157 7/9/2024
2.1.75 125 7/9/2024
2.1.74 72 7/9/2024
2.1.73 179 7/9/2024
2.1.72 78 7/9/2024
2.1.71 751 7/9/2024
2.1.70 70 7/9/2024
2.1.69 2,504 7/9/2024
2.1.68 187 7/9/2024
2.1.67 77 7/9/2024
2.1.66 351 7/9/2024
2.1.65 99 7/9/2024
2.1.64 349 7/9/2024
2.1.63 173 7/9/2024
2.1.62 104 7/9/2024
2.1.61 105 7/8/2024
2.1.60 429 7/8/2024
2.1.59 106 7/8/2024
2.1.58 85 7/8/2024
2.1.57 181 7/8/2024
2.1.56 257 7/8/2024
2.1.55 274 7/8/2024
2.1.54 127 7/8/2024
2.1.53 211 7/8/2024
2.1.52 96 7/8/2024
2.1.51 311 7/8/2024
2.1.50 79 7/8/2024
2.1.49 213 7/7/2024
2.1.48 208 7/7/2024
2.1.47 88 7/7/2024
2.1.46 138 7/7/2024
2.1.45 176 7/7/2024
2.1.44 89 7/7/2024
2.1.43 362 7/7/2024
2.1.42 191 7/7/2024
2.1.41 387 7/5/2024
2.1.40 283 7/4/2024
2.1.39 287 7/3/2024
2.1.38 192 7/3/2024
2.1.37 164 7/3/2024
2.1.36 175 7/3/2024
2.1.35 168 7/3/2024
2.1.34 200 7/3/2024
2.1.33 94 7/3/2024
2.1.32 205 7/3/2024
2.1.31 90 7/3/2024
2.1.30 162 7/3/2024
2.1.29 338 7/3/2024
2.1.28 93 7/3/2024
2.1.27 259 7/3/2024
2.1.26 193 7/3/2024
2.1.25 78 7/3/2024
2.1.24 389 7/3/2024
2.1.23 273 6/30/2024
2.1.22 191 6/30/2024
2.1.21 113 6/30/2024
2.1.20 90 6/30/2024
2.1.19 108 6/30/2024
2.1.18 92 6/30/2024
2.1.17 143 6/30/2024
2.1.16 166 6/30/2024
2.1.15 163 6/29/2024
2.1.14 92 6/29/2024
2.1.13 106 6/29/2024
2.1.12 105 6/29/2024
2.1.11 105 6/29/2024
2.1.10 102 6/29/2024
2.1.9 107 6/29/2024
2.1.8 189 6/28/2024
2.1.7 410 6/27/2024
2.1.6 321 6/27/2024
2.1.5 290 6/24/2024
2.1.4 110 6/24/2024
2.1.3 100 6/24/2024
2.1.2 108 6/24/2024
2.1.1 112 6/24/2024