Created
December 4, 2022 15:23
-
-
Save Speedberg/6546b217b40738c23b3c41b1d098d83c to your computer and use it in GitHub Desktop.
An event manager that listens for when changes are made during Hot Reload
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Reflection.Metadata; | |
[assembly: MetadataUpdateHandler(typeof(HotReloadManager))] | |
/// <summary> | |
/// Fires events when a change is made during Hot Reload | |
/// </summary> | |
/// <remarks> | |
/// For more info, read https://learn.microsoft.com/en-us/dotnet/api/system.reflection.metadata.metadataupdatehandlerattribute?view=net-7.0 | |
///</remarks> | |
internal static class HotReloadManager | |
{ | |
//Clear any old references to properties - reset property cache of control in UI frameworks such as Avalonia | |
public static void ClearCache(Type[]? updatedTypes) | |
{ | |
Console.WriteLine("HotReload: ClearCache"); | |
} | |
//Called after all ClearCache methods are invoked - re-render UI, refresh application, etc | |
public static void UpdateApplication(Type[]? updatedTypes) | |
{ | |
Console.WriteLine("HotReload: UpdateApplication"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment