introduce Resource Declaration and Location properties to offer more resource management options for developers
This commit is contained in:
		| @ -1,4 +1,4 @@ | ||||
| using Microsoft.AspNetCore.Components; | ||||
| using Microsoft.AspNetCore.Components; | ||||
| using Oqtane.Shared; | ||||
| using Oqtane.Models; | ||||
| using System.Threading.Tasks; | ||||
| @ -53,12 +53,15 @@ namespace Oqtane.Modules | ||||
|                 if (Resources != null && Resources.Exists(item => item.ResourceType == ResourceType.Script)) | ||||
|                 { | ||||
|                     var scripts = new List<object>(); | ||||
|                     foreach (Resource resource in Resources.Where(item => item.ResourceType == ResourceType.Script)) | ||||
|                     foreach (Resource resource in Resources.Where(item => item.ResourceType == ResourceType.Script && item.Declaration != ResourceDeclaration.Global)) | ||||
|                     { | ||||
|                         scripts.Add(new { href = resource.Url, bundle = resource.Bundle ?? "", integrity = resource.Integrity ?? "", crossorigin = resource.CrossOrigin ?? "" }); | ||||
|                     } | ||||
|                     var interop = new Interop(JSRuntime); | ||||
|                     await interop.IncludeScripts(scripts.ToArray()); | ||||
|                     if (scripts.Any()) | ||||
|                     { | ||||
|                         var interop = new Interop(JSRuntime); | ||||
|                         await interop.IncludeScripts(scripts.ToArray()); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
| @ -292,4 +295,4 @@ namespace Oqtane.Modules | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Shaun Walker
					Shaun Walker