using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; namespace Flow.Launcher.Plugin { /// /// Synchronous Plugin Model for Flow Launcher /// /// If the Querying or Init method requires high IO transmission /// or performaing CPU intense jobs (performing better with cancellation), please try the IAsyncPlugin interface /// /// public interface IPlugin : IAsyncPlugin { /// /// Querying when user's search changes /// /// This method will be called within a Task.Run, /// so please avoid synchrously wait for long. /// /// /// Query to search /// List Query(Query query); /// /// Initialize plugin /// /// void Init(PluginInitContext context); Task IAsyncPlugin.InitAsync(PluginInitContext context) => Task.Run(() => Init(context)); Task> IAsyncPlugin.QueryAsync(Query query, CancellationToken token) => Task.Run(() => Query(query), token); } }