aboutsummaryrefslogtreecommitdiff
path: root/VNLib.Plugins.Extensions.Loading/Events/ConfigurableAsyncIntervalAttribute.cs
diff options
context:
space:
mode:
authorLibravatar vman <public@vaughnnugent.com>2022-11-16 14:07:28 -0500
committerLibravatar vman <public@vaughnnugent.com>2022-11-16 14:07:28 -0500
commit3fb601d14354c867e1ead94b027c99c4a2fc15b5 (patch)
tree5bf01312166d97eff255d1fdcd26bf314cebcf76 /VNLib.Plugins.Extensions.Loading/Events/ConfigurableAsyncIntervalAttribute.cs
parentc3419e3e43f773ba9ee1e4854e15da873829fbd7 (diff)
Add project files.
Diffstat (limited to 'VNLib.Plugins.Extensions.Loading/Events/ConfigurableAsyncIntervalAttribute.cs')
-rw-r--r--VNLib.Plugins.Extensions.Loading/Events/ConfigurableAsyncIntervalAttribute.cs27
1 files changed, 27 insertions, 0 deletions
diff --git a/VNLib.Plugins.Extensions.Loading/Events/ConfigurableAsyncIntervalAttribute.cs b/VNLib.Plugins.Extensions.Loading/Events/ConfigurableAsyncIntervalAttribute.cs
new file mode 100644
index 0000000..c479f4d
--- /dev/null
+++ b/VNLib.Plugins.Extensions.Loading/Events/ConfigurableAsyncIntervalAttribute.cs
@@ -0,0 +1,27 @@
+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 ConfigurableAsyncIntervalAttribute : Attribute
+ {
+ internal readonly string IntervalPropertyName;
+ internal readonly IntervalResultionType Resolution;
+
+ /// <summary>
+ /// Initializes a <see cref="ConfigurableAsyncIntervalAttribute"/> with the specified
+ /// interval property name
+ /// </summary>
+ /// <param name="configPropName">The configuration property name for the event interval</param>
+ /// <param name="resolution">The time resoltion for the event interval</param>
+ public ConfigurableAsyncIntervalAttribute(string configPropName, IntervalResultionType resolution)
+ {
+ IntervalPropertyName = configPropName;
+ Resolution = resolution;
+ }
+ }
+}