File tree Expand file tree Collapse file tree 8 files changed +24
-15
lines changed Expand file tree Collapse file tree 8 files changed +24
-15
lines changed Original file line number Diff line number Diff line change 22 *
33 * This function searches through the cache storage in reverse chronological order
44 * to find the most recent cached response for a given request.
5- *
5+ *
66 * > [!Note]
77 * > Implementation inspired by Scrapbox's ServiceWorker and Cache usage pattern.
88 *
Original file line number Diff line number Diff line change 11import { textInput } from "./dom.ts" ;
22
33/** Position information within the editor
4- *
4+ *
55 * @see {@linkcode Range } for selection range information
66 */
77export interface Position {
@@ -12,7 +12,7 @@ export interface Position {
1212/** Represents a text selection range in the editor
1313 *
1414 * When no text is selected, {@linkcode start} and {@linkcode end} positions are the same (cursor position)
15- *
15+ *
1616 * @see {@linkcode Position } for position type details
1717 */
1818export interface Range {
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ export interface SetPositionOptions {
1717}
1818
1919/** Class for managing cursor operations in the Scrapbox editor
20- *
20+ *
2121 * @see {@linkcode Position } for cursor position type details
2222 * @see {@linkcode Page } for page data type details
2323 */
Original file line number Diff line number Diff line change @@ -42,15 +42,17 @@ Prepare thumbnail
4242Deno . test ( {
4343 name : "findMetadata()" ,
4444 ignore : true ,
45- fn : ( t ) => assertSnapshot ( t , findMetadata ( text ) )
45+ fn : ( t ) => assertSnapshot ( t , findMetadata ( text ) ) ,
4646} ) ;
4747
4848// Test Helpfeel extraction (lines starting with "?")
4949// These are used for collecting questions and help requests in Scrapbox
5050Deno . test ( {
5151 name : "getHelpfeels()" ,
5252 ignore : true ,
53- fn : ( ) =>
54- assertEquals ( getHelpfeels ( text . split ( "\n" ) . map ( ( text ) => ( { text } ) ) ) , [
55- "Help needed with setup!!" ,
56- ] ) ) ;
53+ fn : ( ) => {
54+ assertEquals ( getHelpfeels ( text . split ( "\n" ) . map ( ( text ) => ( { text } ) ) ) , [
55+ "Help needed with setup!!" ,
56+ ] ) ;
57+ } ,
58+ } ) ;
Original file line number Diff line number Diff line change @@ -42,9 +42,9 @@ export type ListenStreamError =
4242 *
4343 * Example:
4444 * ```ts
45- * listen(socket, "project:update", (data) => {
45+ * listen(socket, "project:update", (data: ProjectUpdateData ) => {
4646 * console.log("Project updated:", data);
47- * }, { signal: abortController .signal });
47+ * }, { signal: controller .signal });
4848 * ```
4949 */
5050export const listen = < EventName extends keyof ListenEvents > (
Original file line number Diff line number Diff line change @@ -43,7 +43,8 @@ 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 changes : Change [ ] = [ { pin : pinNumber ( ) } ] as Change [ ] ;
46+ const pinChange : Change = { pin : pinNumber ( ) } ;
47+ const changes : Change [ ] = [ pinChange ] ;
4748 if ( ! page . persistent ) changes . unshift ( { title } ) ;
4849 return changes ;
4950 } ,
Original file line number Diff line number Diff line change @@ -51,7 +51,9 @@ export type TweetInfoError =
5151 * return;
5252 * }
5353 * const tweetInfo = result.val;
54- * console.log("Tweet text:", tweetInfo.text);
54+ * if (tweetInfo) {
55+ * console.log("Tweet text:", tweetInfo.text);
56+ * }
5557 * ```
5658 *
5759 * Note: The function includes a 3000ms timeout for the API request.
Original file line number Diff line number Diff line change @@ -170,7 +170,9 @@ export const getLinks: GetLinks = /* @__PURE__ */ (() => {
170170 * break;
171171 * }
172172 * const links = result.val; // Array of links in this batch
173- * console.log(`Got ${links.length} links`);
173+ * if (links) {
174+ * console.log(`Got ${links.length} links`);
175+ * }
174176 * }
175177 * ```
176178 */
@@ -216,7 +218,9 @@ export async function* readLinksBulk(
216218 * break;
217219 * }
218220 * const link = result.val; // Single link entry
219- * console.log("Processing link:", link.title);
221+ * if (link) {
222+ * console.log("Processing link:", link.title);
223+ * }
220224 * }
221225 * ```
222226 */
You can’t perform that action at this time.
0 commit comments