@@ -86,22 +86,25 @@ export interface Denops {
8686 *
8787 * @example
8888 * ```ts
89+ * import type { Entrypoint } from "jsr:@denops/core";
8990 * import { is, assert } from "jsr:@core/unknownutil";
9091 *
91- * denops.dispatcher = {
92- * "hello": (name: unknown) => {
93- * assert(name, is.String);
94- * return `Hello, ${name}!`;
95- * },
96- * "add": (a: unknown, b: unknown) => {
97- * assert(a, is.Number);
98- * assert(b, is.Number);
99- * return a + b;
100- * },
101- * "fetchData": async (id: unknown) => {
102- * assert(id, is.String);
103- * return await fetch(`/api/data/${id}`);
104- * },
92+ * export const main: Entrypoint = (denops) => {
93+ * denops.dispatcher = {
94+ * "hello": (name: unknown) => {
95+ * assert(name, is.String);
96+ * return `Hello, ${name}!`;
97+ * },
98+ * "add": (a: unknown, b: unknown) => {
99+ * assert(a, is.Number);
100+ * assert(b, is.Number);
101+ * return a + b;
102+ * },
103+ * "fetchData": async (id: unknown) => {
104+ * assert(id, is.String);
105+ * return await fetch(`/api/data/${id}`);
106+ * },
107+ * };
105108 * };
106109 * ```
107110 */
@@ -168,19 +171,22 @@ export interface Denops {
168171 *
169172 * @example
170173 * ```ts
174+ * import type { Entrypoint } from "jsr:@denops/core";
171175 * import { is } from "jsr:@core/unknownutil";
172176 *
173- * // Call method and validate return type
174- * const result = await denops.dispatch("myPlugin", "hello", "world");
175- * if (is.String(result)) {
176- * console.log(`Greeting: ${result}`);
177- * }
178- *
179- * // Call method with multiple arguments
180- * const sum = await denops.dispatch("calculator", "add", 5, 3);
181- * if (is.Number(sum)) {
182- * console.log(`Sum: ${sum}`);
183- * }
177+ * export const main: Entrypoint = async (denops) => {
178+ * // Call method and validate return type
179+ * const result = await denops.dispatch("myPlugin", "hello", "world");
180+ * if (is.String(result)) {
181+ * console.log(`Greeting: ${result}`);
182+ * }
183+ *
184+ * // Call method with multiple arguments
185+ * const sum = await denops.dispatch("calculator", "add", 5, 3);
186+ * if (is.Number(sum)) {
187+ * console.log(`Sum: ${sum}`);
188+ * }
189+ * };
184190 * ```
185191 */
186192 dispatch ( name : string , fn : string , ...args : unknown [ ] ) : Promise < unknown > ;
0 commit comments