diff options
Diffstat (limited to 'VNLib.Plugins.Extensions.Loading/Events/AsyncIntervalAttribute.cs')
-rw-r--r-- | VNLib.Plugins.Extensions.Loading/Events/AsyncIntervalAttribute.cs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/VNLib.Plugins.Extensions.Loading/Events/AsyncIntervalAttribute.cs b/VNLib.Plugins.Extensions.Loading/Events/AsyncIntervalAttribute.cs new file mode 100644 index 0000000..13495cf --- /dev/null +++ b/VNLib.Plugins.Extensions.Loading/Events/AsyncIntervalAttribute.cs @@ -0,0 +1,23 @@ +using System; + +namespace VNLib.Plugins.Extensions.Loading.Events +{ + /// <summary> + /// When added to a method schedules it as a callback on a specified interval when + /// the plugin is loaded, and stops when unloaded + /// </summary> + [AttributeUsage(AttributeTargets.Method)] + public class AsyncIntervalAttribute : Attribute + { + internal readonly TimeSpan Interval; + + /// <summary> + /// Intializes the <see cref="AsyncIntervalAttribute"/> with the specified timeout in milliseconds + /// </summary> + /// <param name="milliseconds">The interval in milliseconds</param> + public AsyncIntervalAttribute(int milliseconds) + { + Interval = TimeSpan.FromMilliseconds(milliseconds); + } + } +} |