Soenneker.Blazor.Utils.ResourceLoader 2.1.412

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

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

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 (9)

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

Package Downloads
Soenneker.Blazor.FilePond

A Blazor interop library for the file upload library FilePond

Soenneker.Blazor.TomSelect

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

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.428 0 10/2/2024
2.1.427 0 10/2/2024
2.1.426 0 10/2/2024
2.1.425 0 10/2/2024
2.1.424 0 10/2/2024
2.1.423 0 10/2/2024
2.1.422 0 10/2/2024
2.1.421 0 10/2/2024
2.1.420 10 10/2/2024
2.1.419 6 10/2/2024
2.1.418 82 10/2/2024
2.1.417 23 10/2/2024
2.1.416 121 10/1/2024
2.1.415 174 10/1/2024
2.1.414 45 10/1/2024
2.1.413 99 10/1/2024
2.1.412 43 10/1/2024
2.1.411 224 10/1/2024
2.1.410 64 10/1/2024
2.1.409 237 10/1/2024
2.1.408 51 10/1/2024
2.1.407 325 9/29/2024
2.1.406 156 9/29/2024
2.1.405 107 9/29/2024
2.1.404 189 9/29/2024
2.1.403 54 9/29/2024
2.1.402 159 9/29/2024
2.1.401 175 9/29/2024
2.1.400 49 9/29/2024
2.1.399 281 9/29/2024
2.1.398 54 9/29/2024
2.1.397 423 9/27/2024
2.1.396 160 9/27/2024
2.1.395 173 9/27/2024
2.1.394 55 9/27/2024
2.1.393 151 9/27/2024
2.1.392 54 9/27/2024
2.1.391 262 9/27/2024
2.1.390 176 9/27/2024
2.1.389 52 9/27/2024
2.1.388 363 9/27/2024
2.1.387 61 9/27/2024
2.1.386 178 9/27/2024
2.1.385 110 9/27/2024
2.1.384 58 9/27/2024
2.1.383 386 9/27/2024
2.1.382 147 9/27/2024
2.1.381 166 9/26/2024
2.1.380 60 9/26/2024
2.1.379 205 9/26/2024
2.1.378 188 9/26/2024
2.1.377 66 9/26/2024
2.1.376 260 9/26/2024
2.1.375 139 9/26/2024
2.1.374 133 9/26/2024
2.1.373 69 9/26/2024
2.1.372 351 9/26/2024
2.1.371 55 9/26/2024
2.1.370 210 9/26/2024
2.1.369 196 9/26/2024
2.1.368 139 9/26/2024
2.1.367 131 9/26/2024
2.1.366 61 9/26/2024
2.1.365 180 9/26/2024
2.1.364 497 9/24/2024
2.1.363 166 9/23/2024
2.1.362 85 9/23/2024
2.1.361 51 9/23/2024
2.1.360 161 9/23/2024
2.1.359 179 9/23/2024
2.1.358 53 9/23/2024
2.1.357 241 9/23/2024
2.1.356 167 9/23/2024
2.1.355 63 9/23/2024
2.1.354 149 9/23/2024
2.1.353 423 9/23/2024
2.1.352 48 9/23/2024
2.1.351 60 9/23/2024
2.1.350 420 9/23/2024
2.1.349 63 9/23/2024
2.1.348 225 9/23/2024
2.1.347 144 9/23/2024
2.1.346 385 9/23/2024
2.1.345 61 9/23/2024
2.1.344 99 9/23/2024
2.1.343 331 9/23/2024
2.1.342 68 9/23/2024
2.1.341 187 9/23/2024
2.1.340 60 9/23/2024
2.1.339 136 9/23/2024
2.1.338 44 9/23/2024
2.1.337 609 9/18/2024
2.1.336 52 9/18/2024
2.1.335 174 9/18/2024
2.1.334 135 9/18/2024
2.1.333 61 9/18/2024
2.1.332 275 9/18/2024
2.1.331 222 9/18/2024
2.1.330 66 9/18/2024
2.1.329 191 9/18/2024
2.1.328 79 9/18/2024
2.1.327 211 9/18/2024
2.1.326 73 9/18/2024
2.1.325 106 9/17/2024
2.1.324 80 9/17/2024
2.1.323 75 9/17/2024
2.1.322 170 9/17/2024
2.1.321 196 9/17/2024
2.1.320 59 9/17/2024
2.1.319 213 9/17/2024
2.1.318 80 9/17/2024
2.1.317 74 9/17/2024
2.1.316 213 9/17/2024
2.1.315 84 9/17/2024
2.1.314 242 9/17/2024
2.1.313 74 9/17/2024
2.1.312 226 9/17/2024
2.1.311 74 9/17/2024
2.1.310 239 9/17/2024
2.1.309 137 9/17/2024
2.1.308 160 9/17/2024
2.1.307 524 9/17/2024
2.1.306 83 9/17/2024
2.1.305 315 9/16/2024
2.1.304 241 9/16/2024
2.1.303 178 9/16/2024
2.1.302 168 9/16/2024
2.1.301 67 9/16/2024
2.1.300 209 9/16/2024
2.1.299 714 9/12/2024
2.1.298 204 9/12/2024
2.1.297 83 9/12/2024
2.1.296 238 9/12/2024
2.1.295 75 9/12/2024
2.1.294 332 9/12/2024
2.1.293 88 9/12/2024
2.1.292 213 9/12/2024
2.1.291 213 9/12/2024
2.1.290 103 9/12/2024
2.1.289 251 9/12/2024
2.1.288 98 9/12/2024
2.1.287 221 9/11/2024
2.1.286 82 9/11/2024
2.1.285 191 9/11/2024
2.1.284 91 9/11/2024
2.1.282 412 9/11/2024
2.1.281 91 9/11/2024
2.1.280 316 9/11/2024
2.1.279 91 9/11/2024
2.1.278 347 9/11/2024
2.1.277 343 9/11/2024
2.1.276 85 9/11/2024
2.1.275 222 9/11/2024
2.1.274 519 9/11/2024
2.1.273 177 9/10/2024
2.1.272 80 9/10/2024
2.1.271 185 9/10/2024
2.1.270 411 9/10/2024
2.1.269 108 9/10/2024
2.1.268 222 9/10/2024
2.1.267 83 9/10/2024
2.1.266 323 9/10/2024
2.1.265 263 9/10/2024
2.1.263 310 9/10/2024
2.1.262 143 9/10/2024
2.1.261 84 9/9/2024
2.1.260 329 9/9/2024
2.1.259 270 9/9/2024
2.1.258 260 9/9/2024
2.1.257 374 9/9/2024
2.1.255 240 9/9/2024
2.1.254 74 9/9/2024
2.1.253 243 9/9/2024
2.1.252 68 9/9/2024
2.1.251 655 9/7/2024
2.1.250 278 9/7/2024
2.1.249 87 9/7/2024
2.1.248 84 9/7/2024
2.1.247 273 9/7/2024
2.1.246 64 9/7/2024
2.1.245 352 9/6/2024
2.1.244 140 9/6/2024
2.1.243 84 9/6/2024
2.1.242 253 9/6/2024
2.1.241 86 9/6/2024
2.1.240 346 9/6/2024
2.1.239 115 9/6/2024
2.1.238 164 9/6/2024
2.1.237 81 9/6/2024
2.1.236 371 9/5/2024
2.1.235 105 9/5/2024
2.1.234 79 9/5/2024
2.1.233 194 9/5/2024
2.1.232 65 9/5/2024
2.1.231 313 9/5/2024
2.1.230 68 9/5/2024
2.1.229 183 9/5/2024
2.1.228 88 9/5/2024
2.1.227 87 9/5/2024
2.1.226 625 9/5/2024
2.1.225 83 9/5/2024
2.1.224 168 9/5/2024
2.1.223 80 9/5/2024
2.1.222 661 9/4/2024
2.1.221 84 9/4/2024
2.1.220 331 9/4/2024
2.1.219 203 9/4/2024
2.1.218 95 9/4/2024
2.1.217 142 9/4/2024
2.1.216 169 9/3/2024
2.1.215 84 9/3/2024
2.1.214 278 9/3/2024
2.1.213 62 9/3/2024
2.1.212 273 9/3/2024
2.1.211 88 9/3/2024
2.1.210 291 9/3/2024
2.1.209 72 9/3/2024
2.1.207 320 9/3/2024
2.1.206 621 8/29/2024
2.1.205 84 8/29/2024
2.1.204 173 8/29/2024
2.1.203 84 8/29/2024
2.1.202 301 8/29/2024
2.1.201 457 8/26/2024
2.1.200 178 8/26/2024
2.1.199 194 8/26/2024
2.1.197 144 8/26/2024
2.1.196 430 8/26/2024
2.1.195 95 8/26/2024
2.1.194 386 8/21/2024
2.1.193 204 8/21/2024
2.1.192 110 8/21/2024
2.1.191 271 8/21/2024
2.1.190 102 8/21/2024
2.1.189 318 8/21/2024
2.1.188 91 8/21/2024
2.1.187 259 8/21/2024
2.1.186 82 8/21/2024
2.1.185 321 8/20/2024
2.1.184 95 8/20/2024
2.1.183 350 8/20/2024
2.1.182 105 8/20/2024
2.1.181 321 8/20/2024
2.1.180 91 8/20/2024
2.1.179 262 8/20/2024
2.1.178 430 8/20/2024
2.1.177 206 8/19/2024
2.1.176 95 8/19/2024
2.1.175 396 8/15/2024
2.1.174 162 8/15/2024
2.1.173 155 8/15/2024
2.1.172 100 8/15/2024
2.1.171 192 8/15/2024
2.1.170 168 8/15/2024
2.1.169 247 8/15/2024
2.1.168 81 8/15/2024
2.1.167 323 8/15/2024
2.1.166 400 8/14/2024
2.1.165 248 8/14/2024
2.1.164 105 8/14/2024
2.1.163 218 8/14/2024
2.1.162 98 8/14/2024
2.1.161 204 8/13/2024
2.1.160 367 8/13/2024
2.1.159 384 8/7/2024
2.1.158 162 8/7/2024
2.1.157 140 8/7/2024
2.1.156 161 8/7/2024
2.1.155 70 8/7/2024
2.1.154 189 8/7/2024
2.1.153 60 8/7/2024
2.1.152 185 8/6/2024
2.1.151 75 8/6/2024
2.1.150 161 8/6/2024
2.1.149 551 8/1/2024
2.1.148 214 8/1/2024
2.1.147 78 8/1/2024
2.1.146 188 8/1/2024
2.1.145 74 8/1/2024
2.1.144 133 8/1/2024
2.1.143 81 8/1/2024
2.1.142 268 8/1/2024
2.1.141 87 8/1/2024
2.1.140 97 8/1/2024
2.1.139 76 8/1/2024
2.1.138 145 8/1/2024
2.1.137 505 7/25/2024
2.1.136 204 7/25/2024
2.1.135 98 7/25/2024
2.1.134 111 7/25/2024
2.1.133 130 7/25/2024
2.1.132 47 7/25/2024
2.1.131 144 7/25/2024
2.1.130 57 7/25/2024
2.1.129 115 7/25/2024
2.1.128 58 7/25/2024
2.1.127 142 7/25/2024
2.1.126 96 7/25/2024
2.1.125 59 7/25/2024
2.1.124 147 7/25/2024
2.1.123 142 7/25/2024
2.1.122 48 7/25/2024
2.1.121 145 7/24/2024
2.1.120 130 7/24/2024
2.1.119 126 7/24/2024
2.1.118 919 7/20/2024
2.1.117 125 7/20/2024
2.1.116 96 7/20/2024
2.1.115 94 7/20/2024
2.1.114 91 7/20/2024
2.1.113 156 7/20/2024
2.1.112 88 7/20/2024
2.1.111 166 7/20/2024
2.1.110 530 7/17/2024
2.1.109 153 7/17/2024
2.1.108 131 7/17/2024
2.1.107 254 7/14/2024
2.1.106 80 7/14/2024
2.1.105 212 7/14/2024
2.1.104 222 7/14/2024
2.1.103 79 7/14/2024
2.1.102 82 7/14/2024
2.1.101 300 7/14/2024
2.1.100 84 7/14/2024
2.1.99 209 7/14/2024
2.1.98 374 7/11/2024
2.1.97 208 7/10/2024
2.1.96 106 7/10/2024
2.1.95 259 7/10/2024
2.1.94 315 7/10/2024
2.1.93 89 7/10/2024
2.1.92 107 7/10/2024
2.1.91 136 7/10/2024
2.1.90 156 7/10/2024
2.1.89 126 7/10/2024
2.1.88 70 7/10/2024
2.1.87 166 7/10/2024
2.1.86 60 7/10/2024
2.1.85 140 7/10/2024
2.1.84 76 7/10/2024
2.1.83 112 7/10/2024
2.1.82 78 7/10/2024
2.1.81 123 7/10/2024
2.1.80 85 7/10/2024
2.1.79 164 7/10/2024
2.1.78 87 7/10/2024
2.1.77 154 7/9/2024
2.1.75 122 7/9/2024
2.1.74 69 7/9/2024
2.1.73 175 7/9/2024
2.1.72 73 7/9/2024
2.1.71 747 7/9/2024
2.1.70 66 7/9/2024
2.1.69 1,343 7/9/2024
2.1.68 185 7/9/2024
2.1.67 75 7/9/2024
2.1.66 349 7/9/2024
2.1.65 97 7/9/2024
2.1.64 347 7/9/2024
2.1.63 171 7/9/2024
2.1.62 102 7/9/2024
2.1.61 103 7/8/2024
2.1.60 427 7/8/2024
2.1.59 104 7/8/2024
2.1.58 83 7/8/2024
2.1.57 179 7/8/2024
2.1.56 255 7/8/2024
2.1.55 272 7/8/2024
2.1.54 125 7/8/2024
2.1.53 209 7/8/2024
2.1.52 94 7/8/2024
2.1.51 309 7/8/2024
2.1.50 77 7/8/2024
2.1.49 211 7/7/2024
2.1.48 206 7/7/2024
2.1.47 86 7/7/2024
2.1.46 136 7/7/2024
2.1.45 174 7/7/2024
2.1.44 87 7/7/2024
2.1.43 360 7/7/2024
2.1.42 189 7/7/2024
2.1.41 385 7/5/2024
2.1.40 281 7/4/2024
2.1.39 285 7/3/2024
2.1.38 190 7/3/2024
2.1.37 162 7/3/2024
2.1.36 173 7/3/2024
2.1.35 166 7/3/2024
2.1.34 198 7/3/2024
2.1.33 92 7/3/2024
2.1.32 203 7/3/2024
2.1.31 88 7/3/2024
2.1.30 160 7/3/2024
2.1.29 336 7/3/2024
2.1.28 91 7/3/2024
2.1.27 257 7/3/2024
2.1.26 191 7/3/2024
2.1.25 76 7/3/2024
2.1.24 387 7/3/2024
2.1.23 271 6/30/2024
2.1.22 189 6/30/2024
2.1.21 110 6/30/2024
2.1.20 87 6/30/2024
2.1.19 105 6/30/2024
2.1.18 89 6/30/2024
2.1.17 141 6/30/2024
2.1.16 162 6/30/2024
2.1.15 161 6/29/2024
2.1.14 90 6/29/2024
2.1.13 100 6/29/2024
2.1.12 103 6/29/2024
2.1.11 103 6/29/2024
2.1.10 100 6/29/2024
2.1.9 105 6/29/2024
2.1.8 187 6/28/2024
2.1.7 408 6/27/2024
2.1.6 319 6/27/2024
2.1.5 288 6/24/2024
2.1.4 108 6/24/2024
2.1.3 98 6/24/2024
2.1.2 106 6/24/2024
2.1.1 110 6/24/2024