mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Add comment in IPublic, IAsyncPlugin, IReloadable, IAsyncReloadable
This commit is contained in:
parent
a882dcd2fe
commit
763b51858f
4 changed files with 52 additions and 2 deletions
|
|
@ -4,9 +4,24 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace Flow.Launcher.Plugin
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronous Plugin Model for Flow Launcher
|
||||
/// </summary>
|
||||
public interface IAsyncPlugin
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronous Querying
|
||||
/// </summary>
|
||||
/// <param name="query">Query to search</param>
|
||||
/// <param name="token">Cancel when querying job is obsolete</param>
|
||||
/// <returns></returns>
|
||||
Task<List<Result>> QueryAsync(Query query, CancellationToken token);
|
||||
|
||||
/// <summary>
|
||||
/// Initialize plugin asynchrously (will still wait finish to continue)
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <returns></returns>
|
||||
Task InitAsync(PluginInitContext context);
|
||||
}
|
||||
}
|
||||
|
|
@ -2,10 +2,30 @@
|
|||
|
||||
namespace Flow.Launcher.Plugin
|
||||
{
|
||||
/// <summary>
|
||||
/// Synchronous Plugin Model for Flow Launcher
|
||||
/// <para>
|
||||
/// If you assume that Querying or Init method require IO transmission
|
||||
/// or CPU Intense Job (performing better with cancellation), please try IAsyncPlugin interface
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public interface IPlugin
|
||||
{
|
||||
/// <summary>
|
||||
/// Querying when user's search changes
|
||||
/// <para>
|
||||
/// This method will be called within a Task.Run,
|
||||
/// so please avoid synchrously wait for long.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="query">Query to search</param>
|
||||
/// <returns></returns>
|
||||
List<Result> Query(Query query);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initialize plugin
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
void Init(PluginInitContext context);
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,17 @@
|
|||
|
||||
namespace Flow.Launcher.Plugin
|
||||
{
|
||||
/// <summary>
|
||||
/// This interface is to indicate and allow plugins to asyncronously reload their
|
||||
/// in memory data cache or other mediums when user makes a new change
|
||||
/// that is not immediately captured. For example, for BrowserBookmark and Program
|
||||
/// plugin does not automatically detect when a user added a new bookmark or program,
|
||||
/// so this interface's function is exposed to allow user manually do the reloading after
|
||||
/// those new additions.
|
||||
///
|
||||
/// The command that allows user to manual reload is exposed via Plugin.Sys, and
|
||||
/// it will call the plugins that have implemented this interface.
|
||||
/// </summary>
|
||||
public interface IAsyncReloadable
|
||||
{
|
||||
Task ReloadDataAsync();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
namespace Flow.Launcher.Plugin
|
||||
{
|
||||
/// <summary>
|
||||
/// This interface is to indicate and allow plugins to reload their
|
||||
/// This interface is to indicate and allow plugins to synchronously reload their
|
||||
/// in memory data cache or other mediums when user makes a new change
|
||||
/// that is not immediately captured. For example, for BrowserBookmark and Program
|
||||
/// plugin does not automatically detect when a user added a new bookmark or program,
|
||||
|
|
@ -10,6 +10,10 @@
|
|||
///
|
||||
/// The command that allows user to manual reload is exposed via Plugin.Sys, and
|
||||
/// it will call the plugins that have implemented this interface.
|
||||
///
|
||||
/// <para>
|
||||
/// If requiring reloading data asynchrouly, please try IAsyncReloadable
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public interface IReloadable
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue