using System; using Oqtane.Shared; namespace Oqtane.Models { /// /// Resource Objects describe a JavaScript or CSS file which is needed by the Module to work. /// public class Resource { private string _url; /// /// A so the Interop can properly create `script` or `link` tags /// public ResourceType ResourceType { get; set; } /// /// Path to the resource (note that querytring parameters can be included for cache busting ie. ?v=#) /// public string Url { get => _url; set { _url = (value.Contains("://")) ? value : (!value.StartsWith("/") ? "/" : "") + value; } } /// /// Integrity checks to increase the security of resources accessed. Especially common in CDN resources. /// public string Integrity { get; set; } /// /// Cross-Origin rules for this Resources. Usually `anonymous` /// public string CrossOrigin { get; set; } /// /// Bundle ID in case this Resource belongs to a set of Resources, which may have already been loaded using LoadJS /// public string Bundle { get; set; } /// /// For Stylesheets this defines the relative position for cascading purposes /// public ResourceLevel Level { get; set; } /// /// For Scripts this defines if the resource should be included in the Head or Body /// public ResourceLocation Location { get; set; } /// /// For Scripts this allows type="module" registrations - not applicable to Stylesheets /// public bool ES6Module { get; set; } [Obsolete("ResourceDeclaration is deprecated", false)] public ResourceDeclaration Declaration { get; set; } } }