File tree Expand file tree Collapse file tree 3 files changed +13
-6
lines changed
Expand file tree Collapse file tree 3 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -41,8 +41,16 @@ export type ListenStreamError =
4141 * - once: Listen only once if true
4242 *
4343 * Example:
44- * ```ts
45- * listen(socket, "project:update", (data: ProjectUpdateData) => {
44+ * ```typescript
45+ * import { type ScrapboxSocket } from "./socket.ts";
46+ * import { type ListenEvents } from "./listen-events.ts";
47+ *
48+ * // Setup socket and controller
49+ * const socket: ScrapboxSocket = /* ... */ ;
50+ * const controller = new AbortController ( ) ;
51+ *
52+ * // Listen for project updates
53+ * listen < "project:updates" > ( socket , "project:updates" , ( data ) => {
4654 * console . log ( "Project updated:" , data ) ;
4755 * } , { signal: controller . signal } ) ;
4856 * `` `
Original file line number Diff line number Diff line change @@ -43,8 +43,7 @@ export const pin = (
4343 ) return [ ] ;
4444 // Create page and pin it in a single operation
4545 // Note: The server accepts combined creation and pin operations
46- const pinChange : Change = { pin : pinNumber ( ) } ;
47- const changes : Change [ ] = [ pinChange ] ;
46+ const changes : Change [ ] = [ { pin : pinNumber ( ) } ] ;
4847 if ( ! page . persistent ) changes . unshift ( { title } ) ;
4948 return changes ;
5049 } ,
Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ export const getCodeBlocks = (
9797 const codeBlocks : TinyCodeBlock [ ] = [ ] ;
9898
9999 let currentCode : CodeTitle & {
100- /** 読み取り中の行がコードブロックかどうか */
100+ /** Whether the current line is part of a code block */
101101 isCodeBlock : boolean ;
102102 } = {
103103 isCodeBlock : false ,
@@ -137,7 +137,7 @@ export const getCodeBlocks = (
137137 return codeBlocks . filter ( ( codeBlock ) => isMatchFilter ( codeBlock , filter ) ) ;
138138} ;
139139
140- /** コードブロックのフィルターに合致しているか検証する */
140+ /** Verify if a code block matches the specified filter criteria */
141141const isMatchFilter = (
142142 codeBlock : TinyCodeBlock ,
143143 filter ?: GetCodeBlocksFilter ,
You can’t perform that action at this time.
0 commit comments