File tree Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -147,7 +147,7 @@ export interface Denops {
147147/**
148148 * Denops's entrypoint definition.
149149 *
150- * Use this type to ensure the `main` function is properly implemented like
150+ * Use this type to ensure the `main` function is properly implemented like:
151151 *
152152 * ```ts
153153 * import type { Entrypoint } from "https://deno.land/x/denops_core@$MODULE_VERSION/mod.ts";
@@ -156,5 +156,23 @@ export interface Denops {
156156 * // ...
157157 * }
158158 * ```
159+ *
160+ * If an `AsyncDisposable` object is returned, resources can be disposed of
161+ * asynchronously when the plugin is unloaded, like:
162+ *
163+ * ```ts
164+ * import type { Entrypoint } from "https://deno.land/x/denops_core@$MODULE_VERSION/mod.ts";
165+ *
166+ * export const main: Entrypoint = (denops) => {
167+ * // ...
168+ * return {
169+ * [Symbol.asyncDispose]: async () => {
170+ * // Dispose resources...
171+ * }
172+ * }
173+ * }
174+ * ```
159175 */
160- export type Entrypoint = ( denops : Denops ) => void | Promise < void > ;
176+ export type Entrypoint = (
177+ denops : Denops ,
178+ ) => void | AsyncDisposable | Promise < void | AsyncDisposable > ;
You can’t perform that action at this time.
0 commit comments