Soenneker.Blazor.Utils.ResourceLoader 2.1.50

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

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

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.407 71 9/29/2024
2.1.406 80 9/29/2024
2.1.405 55 9/29/2024
2.1.404 89 9/29/2024
2.1.403 34 9/29/2024
2.1.402 81 9/29/2024
2.1.401 81 9/29/2024
2.1.400 28 9/29/2024
2.1.399 134 9/29/2024
2.1.398 28 9/29/2024
2.1.397 216 9/27/2024
2.1.396 87 9/27/2024
2.1.395 88 9/27/2024
2.1.394 33 9/27/2024
2.1.393 71 9/27/2024
2.1.392 29 9/27/2024
2.1.391 129 9/27/2024
2.1.390 92 9/27/2024
2.1.389 32 9/27/2024
2.1.388 162 9/27/2024
2.1.387 35 9/27/2024
2.1.386 94 9/27/2024
2.1.385 61 9/27/2024
2.1.384 36 9/27/2024
2.1.383 200 9/27/2024
2.1.382 88 9/27/2024
2.1.381 85 9/26/2024
2.1.380 35 9/26/2024
2.1.379 99 9/26/2024
2.1.378 104 9/26/2024
2.1.377 36 9/26/2024
2.1.376 134 9/26/2024
2.1.375 73 9/26/2024
2.1.374 74 9/26/2024
2.1.373 35 9/26/2024
2.1.372 174 9/26/2024
2.1.371 33 9/26/2024
2.1.370 110 9/26/2024
2.1.369 100 9/26/2024
2.1.368 71 9/26/2024
2.1.367 74 9/26/2024
2.1.366 39 9/26/2024
2.1.365 84 9/26/2024
2.1.364 363 9/24/2024
2.1.363 156 9/23/2024
2.1.362 77 9/23/2024
2.1.361 50 9/23/2024
2.1.360 138 9/23/2024
2.1.359 164 9/23/2024
2.1.358 52 9/23/2024
2.1.357 220 9/23/2024
2.1.356 146 9/23/2024
2.1.355 62 9/23/2024
2.1.354 127 9/23/2024
2.1.353 395 9/23/2024
2.1.352 47 9/23/2024
2.1.351 59 9/23/2024
2.1.350 409 9/23/2024
2.1.349 62 9/23/2024
2.1.348 197 9/23/2024
2.1.347 131 9/23/2024
2.1.346 375 9/23/2024
2.1.345 60 9/23/2024
2.1.344 98 9/23/2024
2.1.343 330 9/23/2024
2.1.342 67 9/23/2024
2.1.341 186 9/23/2024
2.1.340 59 9/23/2024
2.1.339 135 9/23/2024
2.1.338 43 9/23/2024
2.1.337 579 9/18/2024
2.1.336 51 9/18/2024
2.1.335 173 9/18/2024
2.1.334 134 9/18/2024
2.1.333 60 9/18/2024
2.1.332 274 9/18/2024
2.1.331 221 9/18/2024
2.1.330 65 9/18/2024
2.1.329 190 9/18/2024
2.1.328 78 9/18/2024
2.1.327 210 9/18/2024
2.1.326 72 9/18/2024
2.1.325 105 9/17/2024
2.1.324 79 9/17/2024
2.1.323 74 9/17/2024
2.1.322 169 9/17/2024
2.1.321 195 9/17/2024
2.1.320 58 9/17/2024
2.1.319 212 9/17/2024
2.1.318 79 9/17/2024
2.1.317 73 9/17/2024
2.1.316 212 9/17/2024
2.1.315 83 9/17/2024
2.1.314 241 9/17/2024
2.1.313 73 9/17/2024
2.1.312 225 9/17/2024
2.1.311 73 9/17/2024
2.1.310 238 9/17/2024
2.1.309 136 9/17/2024
2.1.308 159 9/17/2024
2.1.307 523 9/17/2024
2.1.306 82 9/17/2024
2.1.305 314 9/16/2024
2.1.304 240 9/16/2024
2.1.303 177 9/16/2024
2.1.302 167 9/16/2024
2.1.301 66 9/16/2024
2.1.300 208 9/16/2024
2.1.299 711 9/12/2024
2.1.298 203 9/12/2024
2.1.297 82 9/12/2024
2.1.296 237 9/12/2024
2.1.295 74 9/12/2024
2.1.294 331 9/12/2024
2.1.293 87 9/12/2024
2.1.292 212 9/12/2024
2.1.291 212 9/12/2024
2.1.290 102 9/12/2024
2.1.289 250 9/12/2024
2.1.288 97 9/12/2024
2.1.287 220 9/11/2024
2.1.286 81 9/11/2024
2.1.285 190 9/11/2024
2.1.284 90 9/11/2024
2.1.282 411 9/11/2024
2.1.281 90 9/11/2024
2.1.280 315 9/11/2024
2.1.279 90 9/11/2024
2.1.278 346 9/11/2024
2.1.277 342 9/11/2024
2.1.276 84 9/11/2024
2.1.275 221 9/11/2024
2.1.274 518 9/11/2024
2.1.273 176 9/10/2024
2.1.272 79 9/10/2024
2.1.271 184 9/10/2024
2.1.270 410 9/10/2024
2.1.269 107 9/10/2024
2.1.268 221 9/10/2024
2.1.267 82 9/10/2024
2.1.266 322 9/10/2024
2.1.265 262 9/10/2024
2.1.263 309 9/10/2024
2.1.262 142 9/10/2024
2.1.261 83 9/9/2024
2.1.260 328 9/9/2024
2.1.259 269 9/9/2024
2.1.258 259 9/9/2024
2.1.257 373 9/9/2024
2.1.255 239 9/9/2024
2.1.254 73 9/9/2024
2.1.253 242 9/9/2024
2.1.252 67 9/9/2024
2.1.251 654 9/7/2024
2.1.250 277 9/7/2024
2.1.249 86 9/7/2024
2.1.248 83 9/7/2024
2.1.247 272 9/7/2024
2.1.246 63 9/7/2024
2.1.245 351 9/6/2024
2.1.244 139 9/6/2024
2.1.243 83 9/6/2024
2.1.242 252 9/6/2024
2.1.241 85 9/6/2024
2.1.240 345 9/6/2024
2.1.239 114 9/6/2024
2.1.238 163 9/6/2024
2.1.237 80 9/6/2024
2.1.236 370 9/5/2024
2.1.235 104 9/5/2024
2.1.234 78 9/5/2024
2.1.233 193 9/5/2024
2.1.232 64 9/5/2024
2.1.231 312 9/5/2024
2.1.230 67 9/5/2024
2.1.229 182 9/5/2024
2.1.228 87 9/5/2024
2.1.227 86 9/5/2024
2.1.226 624 9/5/2024
2.1.225 82 9/5/2024
2.1.224 167 9/5/2024
2.1.223 79 9/5/2024
2.1.222 660 9/4/2024
2.1.221 83 9/4/2024
2.1.220 330 9/4/2024
2.1.219 202 9/4/2024
2.1.218 94 9/4/2024
2.1.217 141 9/4/2024
2.1.216 168 9/3/2024
2.1.215 83 9/3/2024
2.1.214 277 9/3/2024
2.1.213 60 9/3/2024
2.1.212 272 9/3/2024
2.1.211 87 9/3/2024
2.1.210 290 9/3/2024
2.1.209 71 9/3/2024
2.1.207 319 9/3/2024
2.1.206 620 8/29/2024
2.1.205 83 8/29/2024
2.1.204 172 8/29/2024
2.1.203 83 8/29/2024
2.1.202 300 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 427 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 315 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 158 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 211 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 312 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,277 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 166 7/9/2024
2.1.62 102 7/9/2024
2.1.61 103 7/8/2024
2.1.60 419 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 201 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 280 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 98 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