Soenneker.Blazor.Utils.ResourceLoader 2.1.104

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

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

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 0 11/1/2024
2.1.520 4 11/1/2024
2.1.519 28 11/1/2024
2.1.518 17 11/1/2024
2.1.517 118 11/1/2024
2.1.516 20 11/1/2024
2.1.515 91 11/1/2024
2.1.514 392 10/29/2024
2.1.513 117 10/29/2024
2.1.512 104 10/29/2024
2.1.511 65 10/29/2024
2.1.510 54 10/29/2024
2.1.509 415 10/29/2024
2.1.508 226 10/29/2024
2.1.507 59 10/29/2024
2.1.506 335 10/29/2024
2.1.505 59 10/29/2024
2.1.504 61 10/29/2024
2.1.503 177 10/29/2024
2.1.502 58 10/29/2024
2.1.501 585 10/29/2024
2.1.500 447 10/29/2024
2.1.499 61 10/29/2024
2.1.498 497 10/28/2024
2.1.497 56 10/28/2024
2.1.496 627 10/26/2024
2.1.495 129 10/26/2024
2.1.494 178 10/26/2024
2.1.493 64 10/26/2024
2.1.492 861 10/22/2024
2.1.491 232 10/22/2024
2.1.490 60 10/22/2024
2.1.489 283 10/22/2024
2.1.488 60 10/22/2024
2.1.487 463 10/22/2024
2.1.486 84 10/22/2024
2.1.485 396 10/22/2024
2.1.484 53 10/22/2024
2.1.483 471 10/22/2024
2.1.482 939 10/18/2024
2.1.481 377 10/17/2024
2.1.480 69 10/17/2024
2.1.479 302 10/17/2024
2.1.478 66 10/17/2024
2.1.477 985 10/15/2024
2.1.476 219 10/15/2024
2.1.475 309 10/15/2024
2.1.474 64 10/15/2024
2.1.473 559 10/14/2024
2.1.472 500 10/12/2024
2.1.471 162 10/12/2024
2.1.470 191 10/12/2024
2.1.469 70 10/12/2024
2.1.468 264 10/12/2024
2.1.467 81 10/12/2024
2.1.466 362 10/11/2024
2.1.465 66 10/11/2024
2.1.464 339 10/11/2024
2.1.463 70 10/11/2024
2.1.462 670 10/9/2024
2.1.461 162 10/9/2024
2.1.460 153 10/9/2024
2.1.459 71 10/9/2024
2.1.458 365 10/9/2024
2.1.457 72 10/9/2024
2.1.456 297 10/9/2024
2.1.455 71 10/9/2024
2.1.454 141 10/9/2024
2.1.453 176 10/9/2024
2.1.452 74 10/9/2024
2.1.451 520 10/8/2024
2.1.450 74 10/8/2024
2.1.449 494 10/8/2024
2.1.448 210 10/8/2024
2.1.447 73 10/8/2024
2.1.446 376 10/8/2024
2.1.445 80 10/8/2024
2.1.444 230 10/8/2024
2.1.443 111 10/8/2024
2.1.442 72 10/8/2024
2.1.441 500 10/8/2024
2.1.440 65 10/8/2024
2.1.439 577 10/3/2024
2.1.438 146 10/3/2024
2.1.437 263 10/3/2024
2.1.436 76 10/3/2024
2.1.435 267 10/3/2024
2.1.434 244 10/3/2024
2.1.433 75 10/3/2024
2.1.432 162 10/3/2024
2.1.431 165 10/3/2024
2.1.430 69 10/3/2024
2.1.429 325 10/3/2024
2.1.428 627 10/2/2024
2.1.427 89 10/2/2024
2.1.426 159 10/2/2024
2.1.425 74 10/2/2024
2.1.424 165 10/2/2024
2.1.423 247 10/2/2024
2.1.422 173 10/2/2024
2.1.421 88 10/2/2024
2.1.420 308 10/2/2024
2.1.419 73 10/2/2024
2.1.418 487 10/2/2024
2.1.417 81 10/2/2024
2.1.416 234 10/1/2024
2.1.415 392 10/1/2024
2.1.414 76 10/1/2024
2.1.413 174 10/1/2024
2.1.412 76 10/1/2024
2.1.411 369 10/1/2024
2.1.410 89 10/1/2024
2.1.409 371 10/1/2024
2.1.408 70 10/1/2024
2.1.407 431 9/29/2024
2.1.406 199 9/29/2024
2.1.405 128 9/29/2024
2.1.404 225 9/29/2024
2.1.403 72 9/29/2024
2.1.402 209 9/29/2024
2.1.401 208 9/29/2024
2.1.400 67 9/29/2024
2.1.399 347 9/29/2024
2.1.398 74 9/29/2024
2.1.397 514 9/27/2024
2.1.396 201 9/27/2024
2.1.395 219 9/27/2024
2.1.394 73 9/27/2024
2.1.393 181 9/27/2024
2.1.392 72 9/27/2024
2.1.391 327 9/27/2024
2.1.390 213 9/27/2024
2.1.389 70 9/27/2024
2.1.388 439 9/27/2024
2.1.387 79 9/27/2024
2.1.386 201 9/27/2024
2.1.385 135 9/27/2024
2.1.384 76 9/27/2024
2.1.383 504 9/27/2024
2.1.382 168 9/27/2024
2.1.381 195 9/26/2024
2.1.380 85 9/26/2024
2.1.379 243 9/26/2024
2.1.378 236 9/26/2024
2.1.377 84 9/26/2024
2.1.376 323 9/26/2024
2.1.375 159 9/26/2024
2.1.374 156 9/26/2024
2.1.373 89 9/26/2024
2.1.372 432 9/26/2024
2.1.371 79 9/26/2024
2.1.370 239 9/26/2024
2.1.369 236 9/26/2024
2.1.368 156 9/26/2024
2.1.367 148 9/26/2024
2.1.366 78 9/26/2024
2.1.365 197 9/26/2024
2.1.364 637 9/24/2024
2.1.363 174 9/23/2024
2.1.362 93 9/23/2024
2.1.361 59 9/23/2024
2.1.360 169 9/23/2024
2.1.359 192 9/23/2024
2.1.358 61 9/23/2024
2.1.357 249 9/23/2024
2.1.356 175 9/23/2024
2.1.355 71 9/23/2024
2.1.354 157 9/23/2024
2.1.353 431 9/23/2024
2.1.352 56 9/23/2024
2.1.351 68 9/23/2024
2.1.350 433 9/23/2024
2.1.349 70 9/23/2024
2.1.348 232 9/23/2024
2.1.347 152 9/23/2024
2.1.346 398 9/23/2024
2.1.345 69 9/23/2024
2.1.344 107 9/23/2024
2.1.343 339 9/23/2024
2.1.342 76 9/23/2024
2.1.341 195 9/23/2024
2.1.340 68 9/23/2024
2.1.339 144 9/23/2024
2.1.338 52 9/23/2024
2.1.337 751 9/18/2024
2.1.336 59 9/18/2024
2.1.335 181 9/18/2024
2.1.334 141 9/18/2024
2.1.333 67 9/18/2024
2.1.332 286 9/18/2024
2.1.331 233 9/18/2024
2.1.330 77 9/18/2024
2.1.329 202 9/18/2024
2.1.328 89 9/18/2024
2.1.327 222 9/18/2024
2.1.326 84 9/18/2024
2.1.325 113 9/17/2024
2.1.324 92 9/17/2024
2.1.323 86 9/17/2024
2.1.322 181 9/17/2024
2.1.321 208 9/17/2024
2.1.320 71 9/17/2024
2.1.319 225 9/17/2024
2.1.318 92 9/17/2024
2.1.317 86 9/17/2024
2.1.316 225 9/17/2024
2.1.315 95 9/17/2024
2.1.314 252 9/17/2024
2.1.313 85 9/17/2024
2.1.312 236 9/17/2024
2.1.311 85 9/17/2024
2.1.310 250 9/17/2024
2.1.309 148 9/17/2024
2.1.308 167 9/17/2024
2.1.307 537 9/17/2024
2.1.306 94 9/17/2024
2.1.305 325 9/16/2024
2.1.304 253 9/16/2024
2.1.303 189 9/16/2024
2.1.302 179 9/16/2024
2.1.301 78 9/16/2024
2.1.300 220 9/16/2024
2.1.299 823 9/12/2024
2.1.298 211 9/12/2024
2.1.297 90 9/12/2024
2.1.296 245 9/12/2024
2.1.295 82 9/12/2024
2.1.294 338 9/12/2024
2.1.293 94 9/12/2024
2.1.292 219 9/12/2024
2.1.291 219 9/12/2024
2.1.290 109 9/12/2024
2.1.289 257 9/12/2024
2.1.288 104 9/12/2024
2.1.287 227 9/11/2024
2.1.286 88 9/11/2024
2.1.285 197 9/11/2024
2.1.284 97 9/11/2024
2.1.282 419 9/11/2024
2.1.281 98 9/11/2024
2.1.280 323 9/11/2024
2.1.279 98 9/11/2024
2.1.278 355 9/11/2024
2.1.277 351 9/11/2024
2.1.276 93 9/11/2024
2.1.275 229 9/11/2024
2.1.274 526 9/11/2024
2.1.273 184 9/10/2024
2.1.272 87 9/10/2024
2.1.271 193 9/10/2024
2.1.270 420 9/10/2024
2.1.269 115 9/10/2024
2.1.268 230 9/10/2024
2.1.267 91 9/10/2024
2.1.266 331 9/10/2024
2.1.265 271 9/10/2024
2.1.263 318 9/10/2024
2.1.262 151 9/10/2024
2.1.261 92 9/9/2024
2.1.260 337 9/9/2024
2.1.259 278 9/9/2024
2.1.258 268 9/9/2024
2.1.257 382 9/9/2024
2.1.255 253 9/9/2024
2.1.254 83 9/9/2024
2.1.253 252 9/9/2024
2.1.252 75 9/9/2024
2.1.251 662 9/7/2024
2.1.250 287 9/7/2024
2.1.249 96 9/7/2024
2.1.248 93 9/7/2024
2.1.247 283 9/7/2024
2.1.246 73 9/7/2024
2.1.245 360 9/6/2024
2.1.244 148 9/6/2024
2.1.243 92 9/6/2024
2.1.242 261 9/6/2024
2.1.241 95 9/6/2024
2.1.240 353 9/6/2024
2.1.239 122 9/6/2024
2.1.238 172 9/6/2024
2.1.237 89 9/6/2024
2.1.236 378 9/5/2024
2.1.235 113 9/5/2024
2.1.234 88 9/5/2024
2.1.233 201 9/5/2024
2.1.232 72 9/5/2024
2.1.231 321 9/5/2024
2.1.230 76 9/5/2024
2.1.229 191 9/5/2024
2.1.228 96 9/5/2024
2.1.227 95 9/5/2024
2.1.226 638 9/5/2024
2.1.225 91 9/5/2024
2.1.224 176 9/5/2024
2.1.223 88 9/5/2024
2.1.222 668 9/4/2024
2.1.221 91 9/4/2024
2.1.220 338 9/4/2024
2.1.219 211 9/4/2024
2.1.218 103 9/4/2024
2.1.217 151 9/4/2024
2.1.216 177 9/3/2024
2.1.215 92 9/3/2024
2.1.214 284 9/3/2024
2.1.213 68 9/3/2024
2.1.212 281 9/3/2024
2.1.211 96 9/3/2024
2.1.210 298 9/3/2024
2.1.209 80 9/3/2024
2.1.207 327 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,246 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