@@ -86,22 +86,25 @@ export interface Denops {
86
86
*
87
87
* @example
88
88
* ```ts
89
+ * import type { Entrypoint } from "jsr:@denops/core";
89
90
* import { is, assert } from "jsr:@core/unknownutil";
90
91
*
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
+ * };
105
108
* };
106
109
* ```
107
110
*/
@@ -168,19 +171,22 @@ export interface Denops {
168
171
*
169
172
* @example
170
173
* ```ts
174
+ * import type { Entrypoint } from "jsr:@denops/core";
171
175
* import { is } from "jsr:@core/unknownutil";
172
176
*
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
+ * };
184
190
* ```
185
191
*/
186
192
dispatch ( name : string , fn : string , ...args : unknown [ ] ) : Promise < unknown > ;
0 commit comments