script reload improvements
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Models
|
||||
@ -13,7 +12,7 @@ namespace Oqtane.Models
|
||||
private string _url;
|
||||
|
||||
/// <summary>
|
||||
/// A <see cref="ResourceType"/> so the Interop can properly create `script` or `link` tags
|
||||
/// A <see cref="ResourceType"/> to define the type of resource ie. Script or Stylesheet
|
||||
/// </summary>
|
||||
public ResourceType ResourceType { get; set; }
|
||||
|
||||
@ -45,7 +44,7 @@ namespace Oqtane.Models
|
||||
public string CrossOrigin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// For Scripts a Bundle can be used to identify dependencies and ordering in the script loading process
|
||||
/// For Scripts a Bundle can be used to identify dependencies and ordering in the script loading process (for Interactive rendering only)
|
||||
/// </summary>
|
||||
public string Bundle { get; set; }
|
||||
|
||||
@ -60,7 +59,7 @@ namespace Oqtane.Models
|
||||
public ResourceLocation Location { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Allows specification of inline script - not applicable to Stylesheets
|
||||
/// For Scripts this allows for the specification of inline script - not applicable to Stylesheets
|
||||
/// </summary>
|
||||
public string Content { get; set; }
|
||||
|
||||
@ -70,9 +69,9 @@ namespace Oqtane.Models
|
||||
public string RenderMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that a script should be reloaded on every page transition - not applicable to Stylesheets
|
||||
/// Specifies how a script should be loaded in Static rendering - not applicable to Stylesheets
|
||||
/// </summary>
|
||||
public bool Reload { get; set; }
|
||||
public ResourceLoadBehavior LoadBehavior { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Cusotm data-* attributes for scripts - not applicable to Stylesheets
|
||||
@ -96,7 +95,7 @@ namespace Oqtane.Models
|
||||
resource.Location = Location;
|
||||
resource.Content = Content;
|
||||
resource.RenderMode = RenderMode;
|
||||
resource.Reload = Reload;
|
||||
resource.LoadBehavior = LoadBehavior;
|
||||
resource.DataAttributes = new Dictionary<string, string>();
|
||||
if (DataAttributes != null && DataAttributes.Count > 0)
|
||||
{
|
||||
@ -125,5 +124,18 @@ namespace Oqtane.Models
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete("Reload is deprecated. Use LoadBehavior property instead for scripts.", false)]
|
||||
public bool Reload
|
||||
{
|
||||
get => (LoadBehavior == ResourceLoadBehavior.BlazorPageScript);
|
||||
set
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
LoadBehavior = ResourceLoadBehavior.BlazorPageScript;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user