Soenneker.Blazor.Utils.ResourceLoader 2.1.304

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.304                
NuGet\Install-Package Soenneker.Blazor.Utils.ResourceLoader -Version 2.1.304                
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.304" />                
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.304                
#r "nuget: Soenneker.Blazor.Utils.ResourceLoader, 2.1.304"                
#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.304

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

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.ApplicationInsights

A Blazor interop library that sets up client-side Application Insights

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.1.521 119 11/1/2024
2.1.520 116 11/1/2024
2.1.519 89 11/1/2024
2.1.518 27 11/1/2024
2.1.517 139 11/1/2024
2.1.516 28 11/1/2024
2.1.515 95 11/1/2024
2.1.514 397 10/29/2024
2.1.513 118 10/29/2024
2.1.512 105 10/29/2024
2.1.511 66 10/29/2024
2.1.510 55 10/29/2024
2.1.509 416 10/29/2024
2.1.508 227 10/29/2024
2.1.507 60 10/29/2024
2.1.506 336 10/29/2024
2.1.505 60 10/29/2024
2.1.504 62 10/29/2024
2.1.503 178 10/29/2024
2.1.502 59 10/29/2024
2.1.501 586 10/29/2024
2.1.500 448 10/29/2024
2.1.499 62 10/29/2024
2.1.498 498 10/28/2024
2.1.497 57 10/28/2024
2.1.496 640 10/26/2024
2.1.495 130 10/26/2024
2.1.494 179 10/26/2024
2.1.493 65 10/26/2024
2.1.492 874 10/22/2024
2.1.491 233 10/22/2024
2.1.490 61 10/22/2024
2.1.489 284 10/22/2024
2.1.488 61 10/22/2024
2.1.487 464 10/22/2024
2.1.486 85 10/22/2024
2.1.485 397 10/22/2024
2.1.484 54 10/22/2024
2.1.483 472 10/22/2024
2.1.482 944 10/18/2024
2.1.481 378 10/17/2024
2.1.480 70 10/17/2024
2.1.479 303 10/17/2024
2.1.478 67 10/17/2024
2.1.477 986 10/15/2024
2.1.476 220 10/15/2024
2.1.475 310 10/15/2024
2.1.474 65 10/15/2024
2.1.473 560 10/14/2024
2.1.472 501 10/12/2024
2.1.471 163 10/12/2024
2.1.470 192 10/12/2024
2.1.469 71 10/12/2024
2.1.468 265 10/12/2024
2.1.467 82 10/12/2024
2.1.466 363 10/11/2024
2.1.465 67 10/11/2024
2.1.464 340 10/11/2024
2.1.463 71 10/11/2024
2.1.462 671 10/9/2024
2.1.461 163 10/9/2024
2.1.460 154 10/9/2024
2.1.459 72 10/9/2024
2.1.458 366 10/9/2024
2.1.457 73 10/9/2024
2.1.456 298 10/9/2024
2.1.455 72 10/9/2024
2.1.454 142 10/9/2024
2.1.453 177 10/9/2024
2.1.452 75 10/9/2024
2.1.451 521 10/8/2024
2.1.450 75 10/8/2024
2.1.449 495 10/8/2024
2.1.448 211 10/8/2024
2.1.447 74 10/8/2024
2.1.446 377 10/8/2024
2.1.445 81 10/8/2024
2.1.444 231 10/8/2024
2.1.443 112 10/8/2024
2.1.442 73 10/8/2024
2.1.441 501 10/8/2024
2.1.440 66 10/8/2024
2.1.439 578 10/3/2024
2.1.438 147 10/3/2024
2.1.437 264 10/3/2024
2.1.436 77 10/3/2024
2.1.435 268 10/3/2024
2.1.434 245 10/3/2024
2.1.433 76 10/3/2024
2.1.432 163 10/3/2024
2.1.431 166 10/3/2024
2.1.430 70 10/3/2024
2.1.429 326 10/3/2024
2.1.428 628 10/2/2024
2.1.427 90 10/2/2024
2.1.426 160 10/2/2024
2.1.425 75 10/2/2024
2.1.424 166 10/2/2024
2.1.423 248 10/2/2024
2.1.422 174 10/2/2024
2.1.421 89 10/2/2024
2.1.420 309 10/2/2024
2.1.419 74 10/2/2024
2.1.418 488 10/2/2024
2.1.417 82 10/2/2024
2.1.416 235 10/1/2024
2.1.415 393 10/1/2024
2.1.414 77 10/1/2024
2.1.413 175 10/1/2024
2.1.412 77 10/1/2024
2.1.411 370 10/1/2024
2.1.410 90 10/1/2024
2.1.409 372 10/1/2024
2.1.408 71 10/1/2024
2.1.407 432 9/29/2024
2.1.406 200 9/29/2024
2.1.405 129 9/29/2024
2.1.404 226 9/29/2024
2.1.403 73 9/29/2024
2.1.402 210 9/29/2024
2.1.401 209 9/29/2024
2.1.400 68 9/29/2024
2.1.399 348 9/29/2024
2.1.398 75 9/29/2024
2.1.397 515 9/27/2024
2.1.396 202 9/27/2024
2.1.395 220 9/27/2024
2.1.394 74 9/27/2024
2.1.393 182 9/27/2024
2.1.392 73 9/27/2024
2.1.391 328 9/27/2024
2.1.390 214 9/27/2024
2.1.389 71 9/27/2024
2.1.388 440 9/27/2024
2.1.387 80 9/27/2024
2.1.386 202 9/27/2024
2.1.385 136 9/27/2024
2.1.384 77 9/27/2024
2.1.383 505 9/27/2024
2.1.382 169 9/27/2024
2.1.381 196 9/26/2024
2.1.380 86 9/26/2024
2.1.379 244 9/26/2024
2.1.378 237 9/26/2024
2.1.377 85 9/26/2024
2.1.376 324 9/26/2024
2.1.375 160 9/26/2024
2.1.374 157 9/26/2024
2.1.373 90 9/26/2024
2.1.372 433 9/26/2024
2.1.371 80 9/26/2024
2.1.370 240 9/26/2024
2.1.369 237 9/26/2024
2.1.368 157 9/26/2024
2.1.367 149 9/26/2024
2.1.366 79 9/26/2024
2.1.365 198 9/26/2024
2.1.364 638 9/24/2024
2.1.363 175 9/23/2024
2.1.362 94 9/23/2024
2.1.361 60 9/23/2024
2.1.360 170 9/23/2024
2.1.359 193 9/23/2024
2.1.358 62 9/23/2024
2.1.357 250 9/23/2024
2.1.356 176 9/23/2024
2.1.355 72 9/23/2024
2.1.354 158 9/23/2024
2.1.353 432 9/23/2024
2.1.352 57 9/23/2024
2.1.351 69 9/23/2024
2.1.350 434 9/23/2024
2.1.349 71 9/23/2024
2.1.348 233 9/23/2024
2.1.347 153 9/23/2024
2.1.346 399 9/23/2024
2.1.345 70 9/23/2024
2.1.344 108 9/23/2024
2.1.343 340 9/23/2024
2.1.342 77 9/23/2024
2.1.341 196 9/23/2024
2.1.340 69 9/23/2024
2.1.339 145 9/23/2024
2.1.338 53 9/23/2024
2.1.337 752 9/18/2024
2.1.336 60 9/18/2024
2.1.335 182 9/18/2024
2.1.334 142 9/18/2024
2.1.333 68 9/18/2024
2.1.332 287 9/18/2024
2.1.331 234 9/18/2024
2.1.330 78 9/18/2024
2.1.329 203 9/18/2024
2.1.328 90 9/18/2024
2.1.327 223 9/18/2024
2.1.326 85 9/18/2024
2.1.325 114 9/17/2024
2.1.324 93 9/17/2024
2.1.323 87 9/17/2024
2.1.322 182 9/17/2024
2.1.321 209 9/17/2024
2.1.320 72 9/17/2024
2.1.319 226 9/17/2024
2.1.318 93 9/17/2024
2.1.317 87 9/17/2024
2.1.316 226 9/17/2024
2.1.315 96 9/17/2024
2.1.314 253 9/17/2024
2.1.313 86 9/17/2024
2.1.312 237 9/17/2024
2.1.311 86 9/17/2024
2.1.310 251 9/17/2024
2.1.309 149 9/17/2024
2.1.308 168 9/17/2024
2.1.307 538 9/17/2024
2.1.306 95 9/17/2024
2.1.305 326 9/16/2024
2.1.304 254 9/16/2024
2.1.303 190 9/16/2024
2.1.302 180 9/16/2024
2.1.301 79 9/16/2024
2.1.300 221 9/16/2024
2.1.299 824 9/12/2024
2.1.298 212 9/12/2024
2.1.297 91 9/12/2024
2.1.296 246 9/12/2024
2.1.295 83 9/12/2024
2.1.294 339 9/12/2024
2.1.293 95 9/12/2024
2.1.292 220 9/12/2024
2.1.291 220 9/12/2024
2.1.290 110 9/12/2024
2.1.289 258 9/12/2024
2.1.288 105 9/12/2024
2.1.287 228 9/11/2024
2.1.286 89 9/11/2024
2.1.285 198 9/11/2024
2.1.284 98 9/11/2024
2.1.282 420 9/11/2024
2.1.281 99 9/11/2024
2.1.280 324 9/11/2024
2.1.279 99 9/11/2024
2.1.278 356 9/11/2024
2.1.277 352 9/11/2024
2.1.276 94 9/11/2024
2.1.275 230 9/11/2024
2.1.274 527 9/11/2024
2.1.273 185 9/10/2024
2.1.272 88 9/10/2024
2.1.271 194 9/10/2024
2.1.270 421 9/10/2024
2.1.269 116 9/10/2024
2.1.268 231 9/10/2024
2.1.267 92 9/10/2024
2.1.266 332 9/10/2024
2.1.265 272 9/10/2024
2.1.263 319 9/10/2024
2.1.262 152 9/10/2024
2.1.261 93 9/9/2024
2.1.260 338 9/9/2024
2.1.259 279 9/9/2024
2.1.258 269 9/9/2024
2.1.257 383 9/9/2024
2.1.255 254 9/9/2024
2.1.254 84 9/9/2024
2.1.253 253 9/9/2024
2.1.252 76 9/9/2024
2.1.251 663 9/7/2024
2.1.250 288 9/7/2024
2.1.249 97 9/7/2024
2.1.248 94 9/7/2024
2.1.247 284 9/7/2024
2.1.246 74 9/7/2024
2.1.245 361 9/6/2024
2.1.244 149 9/6/2024
2.1.243 93 9/6/2024
2.1.242 262 9/6/2024
2.1.241 96 9/6/2024
2.1.240 354 9/6/2024
2.1.239 123 9/6/2024
2.1.238 173 9/6/2024
2.1.237 90 9/6/2024
2.1.236 379 9/5/2024
2.1.235 114 9/5/2024
2.1.234 89 9/5/2024
2.1.233 202 9/5/2024
2.1.232 73 9/5/2024
2.1.231 322 9/5/2024
2.1.230 77 9/5/2024
2.1.229 192 9/5/2024
2.1.228 97 9/5/2024
2.1.227 96 9/5/2024
2.1.226 639 9/5/2024
2.1.225 92 9/5/2024
2.1.224 177 9/5/2024
2.1.223 89 9/5/2024
2.1.222 669 9/4/2024
2.1.221 92 9/4/2024
2.1.220 339 9/4/2024
2.1.219 212 9/4/2024
2.1.218 104 9/4/2024
2.1.217 152 9/4/2024
2.1.216 178 9/3/2024
2.1.215 93 9/3/2024
2.1.214 285 9/3/2024
2.1.213 69 9/3/2024
2.1.212 282 9/3/2024
2.1.211 97 9/3/2024
2.1.210 299 9/3/2024
2.1.209 81 9/3/2024
2.1.207 328 9/3/2024
2.1.206 625 8/29/2024
2.1.205 88 8/29/2024
2.1.204 175 8/29/2024
2.1.203 87 8/29/2024
2.1.202 305 8/29/2024
2.1.201 463 8/26/2024
2.1.200 182 8/26/2024
2.1.199 198 8/26/2024
2.1.197 148 8/26/2024
2.1.196 435 8/26/2024
2.1.195 100 8/26/2024
2.1.194 394 8/21/2024
2.1.193 208 8/21/2024
2.1.192 114 8/21/2024
2.1.191 275 8/21/2024
2.1.190 110 8/21/2024
2.1.189 326 8/21/2024
2.1.188 95 8/21/2024
2.1.187 263 8/21/2024
2.1.186 90 8/21/2024
2.1.185 330 8/20/2024
2.1.184 99 8/20/2024
2.1.183 354 8/20/2024
2.1.182 109 8/20/2024
2.1.181 330 8/20/2024
2.1.180 95 8/20/2024
2.1.179 266 8/20/2024
2.1.178 434 8/20/2024
2.1.177 210 8/19/2024
2.1.176 99 8/19/2024
2.1.175 403 8/15/2024
2.1.174 166 8/15/2024
2.1.173 159 8/15/2024
2.1.172 104 8/15/2024
2.1.171 196 8/15/2024
2.1.170 172 8/15/2024
2.1.169 251 8/15/2024
2.1.168 85 8/15/2024
2.1.167 327 8/15/2024
2.1.166 404 8/14/2024
2.1.165 252 8/14/2024
2.1.164 109 8/14/2024
2.1.163 221 8/14/2024
2.1.162 101 8/14/2024
2.1.161 207 8/13/2024
2.1.160 370 8/13/2024
2.1.159 418 8/7/2024
2.1.158 169 8/7/2024
2.1.157 145 8/7/2024
2.1.156 166 8/7/2024
2.1.155 75 8/7/2024
2.1.154 194 8/7/2024
2.1.153 66 8/7/2024
2.1.152 190 8/6/2024
2.1.151 79 8/6/2024
2.1.150 166 8/6/2024
2.1.149 555 8/1/2024
2.1.148 218 8/1/2024
2.1.147 83 8/1/2024
2.1.146 191 8/1/2024
2.1.145 77 8/1/2024
2.1.144 138 8/1/2024
2.1.143 86 8/1/2024
2.1.142 272 8/1/2024
2.1.141 90 8/1/2024
2.1.140 100 8/1/2024
2.1.139 80 8/1/2024
2.1.138 156 8/1/2024
2.1.137 508 7/25/2024
2.1.136 207 7/25/2024
2.1.135 101 7/25/2024
2.1.134 114 7/25/2024
2.1.133 133 7/25/2024
2.1.132 50 7/25/2024
2.1.131 147 7/25/2024
2.1.130 60 7/25/2024
2.1.129 118 7/25/2024
2.1.128 61 7/25/2024
2.1.127 145 7/25/2024
2.1.126 99 7/25/2024
2.1.125 62 7/25/2024
2.1.124 150 7/25/2024
2.1.123 145 7/25/2024
2.1.122 51 7/25/2024
2.1.121 148 7/24/2024
2.1.120 133 7/24/2024
2.1.119 129 7/24/2024
2.1.118 923 7/20/2024
2.1.117 128 7/20/2024
2.1.116 99 7/20/2024
2.1.115 97 7/20/2024
2.1.114 94 7/20/2024
2.1.113 159 7/20/2024
2.1.112 91 7/20/2024
2.1.111 169 7/20/2024
2.1.110 532 7/17/2024
2.1.109 155 7/17/2024
2.1.108 133 7/17/2024
2.1.107 256 7/14/2024
2.1.106 82 7/14/2024
2.1.105 214 7/14/2024
2.1.104 224 7/14/2024
2.1.103 81 7/14/2024
2.1.102 84 7/14/2024
2.1.101 302 7/14/2024
2.1.100 86 7/14/2024
2.1.99 211 7/14/2024
2.1.98 376 7/11/2024
2.1.97 210 7/10/2024
2.1.96 108 7/10/2024
2.1.95 261 7/10/2024
2.1.94 317 7/10/2024
2.1.93 91 7/10/2024
2.1.92 109 7/10/2024
2.1.91 138 7/10/2024
2.1.90 158 7/10/2024
2.1.89 128 7/10/2024
2.1.88 71 7/10/2024
2.1.87 168 7/10/2024
2.1.86 63 7/10/2024
2.1.85 142 7/10/2024
2.1.84 79 7/10/2024
2.1.83 115 7/10/2024
2.1.82 81 7/10/2024
2.1.81 125 7/10/2024
2.1.80 86 7/10/2024
2.1.79 166 7/10/2024
2.1.78 89 7/10/2024
2.1.77 156 7/9/2024
2.1.75 124 7/9/2024
2.1.74 71 7/9/2024
2.1.73 178 7/9/2024
2.1.72 77 7/9/2024
2.1.71 750 7/9/2024
2.1.70 69 7/9/2024
2.1.69 2,276 7/9/2024
2.1.68 186 7/9/2024
2.1.67 76 7/9/2024
2.1.66 350 7/9/2024
2.1.65 98 7/9/2024
2.1.64 348 7/9/2024
2.1.63 172 7/9/2024
2.1.62 103 7/9/2024
2.1.61 104 7/8/2024
2.1.60 428 7/8/2024
2.1.59 105 7/8/2024
2.1.58 84 7/8/2024
2.1.57 180 7/8/2024
2.1.56 256 7/8/2024
2.1.55 273 7/8/2024
2.1.54 126 7/8/2024
2.1.53 210 7/8/2024
2.1.52 95 7/8/2024
2.1.51 310 7/8/2024
2.1.50 78 7/8/2024
2.1.49 212 7/7/2024
2.1.48 207 7/7/2024
2.1.47 87 7/7/2024
2.1.46 137 7/7/2024
2.1.45 175 7/7/2024
2.1.44 88 7/7/2024
2.1.43 361 7/7/2024
2.1.42 190 7/7/2024
2.1.41 386 7/5/2024
2.1.40 282 7/4/2024
2.1.39 286 7/3/2024
2.1.38 191 7/3/2024
2.1.37 163 7/3/2024
2.1.36 174 7/3/2024
2.1.35 167 7/3/2024
2.1.34 199 7/3/2024
2.1.33 93 7/3/2024
2.1.32 204 7/3/2024
2.1.31 89 7/3/2024
2.1.30 161 7/3/2024
2.1.29 337 7/3/2024
2.1.28 92 7/3/2024
2.1.27 258 7/3/2024
2.1.26 192 7/3/2024
2.1.25 77 7/3/2024
2.1.24 388 7/3/2024
2.1.23 272 6/30/2024
2.1.22 190 6/30/2024
2.1.21 111 6/30/2024
2.1.20 88 6/30/2024
2.1.19 106 6/30/2024
2.1.18 90 6/30/2024
2.1.17 142 6/30/2024
2.1.16 165 6/30/2024
2.1.15 162 6/29/2024
2.1.14 91 6/29/2024
2.1.13 105 6/29/2024
2.1.12 104 6/29/2024
2.1.11 104 6/29/2024
2.1.10 101 6/29/2024
2.1.9 106 6/29/2024
2.1.8 188 6/28/2024
2.1.7 409 6/27/2024
2.1.6 320 6/27/2024
2.1.5 289 6/24/2024
2.1.4 109 6/24/2024
2.1.3 99 6/24/2024
2.1.2 107 6/24/2024
2.1.1 111 6/24/2024