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 =
41
41
* - once: Listen only once if true
42
42
*
43
43
* 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 ) => {
46
54
* console . log ( "Project updated:" , data ) ;
47
55
* } , { signal: controller . signal } ) ;
48
56
* `` `
Original file line number Diff line number Diff line change @@ -43,8 +43,7 @@ export const pin = (
43
43
) return [ ] ;
44
44
// Create page and pin it in a single operation
45
45
// 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 ( ) } ] ;
48
47
if ( ! page . persistent ) changes . unshift ( { title } ) ;
49
48
return changes ;
50
49
} ,
Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ export const getCodeBlocks = (
97
97
const codeBlocks : TinyCodeBlock [ ] = [ ] ;
98
98
99
99
let currentCode : CodeTitle & {
100
- /** 読み取り中の行がコードブロックかどうか */
100
+ /** Whether the current line is part of a code block */
101
101
isCodeBlock : boolean ;
102
102
} = {
103
103
isCodeBlock : false ,
@@ -137,7 +137,7 @@ export const getCodeBlocks = (
137
137
return codeBlocks . filter ( ( codeBlock ) => isMatchFilter ( codeBlock , filter ) ) ;
138
138
} ;
139
139
140
- /** コードブロックのフィルターに合致しているか検証する */
140
+ /** Verify if a code block matches the specified filter criteria */
141
141
const isMatchFilter = (
142
142
codeBlock : TinyCodeBlock ,
143
143
filter ?: GetCodeBlocksFilter ,
You can’t perform that action at this time.
0 commit comments