/
page.d.ts
69 lines (58 loc) · 1.95 KB
/
page.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/// <reference no-default-lib="true"/>
/// <reference lib="esnext"/>
/// <reference lib="dom" />
import { BaseStore } from "../../deps/scrapbox.ts";
import { Page as PageData } from "../../deps/scrapbox-rest.ts";
export interface SetPositionOptions {
/** カーソルが画面外に移動したとき、カーソルが見える位置までページをスクロールするかどうか
*
* @default true
*/
scrollInView?: boolean;
/** カーソル移動イベントの発生箇所?
*
* コード内だと、"mouse"が指定されていた場合があった。詳細は不明
*/
source?: "mouse";
}
export interface ApiUrlForFetch {
projectName: string;
title: string;
titleHint: string;
followRename: boolean;
search: string;
}
export interface ApplySnapshotInit {
page: Pick<PageData, "title" | "lines" | "created">;
prevPage?: Pick<PageData, "created">;
nextPage?: Pick<PageData, "lines">;
}
export type PageWithCache = PageData & { cachedAt: number | undefined };
/** Scrapboxのページデータを管理する内部クラス
*
* 一部型定義は書きかけ
*/
export declare class Page extends BaseStore<
{ source: "mouse" | undefined } | "focusTextInput" | "scroll" | undefined
> {
public initialize(): void;
private data: PageWithCache;
public get(): PageWithCache;
public apiUrlForFetch(init: ApiUrlForFetch): string;
public apiUrlForUpdatePageAccessed(pageId: string): string;
public fetch(): Promise<PageWithCache>;
public set(page: PageWithCache): void;
public reset(): void;
public applySnapshot(init: ApplySnapshotInit): void;
setTitle(title: string, init?: { from: string }): void;
get fromCacheStorage(): boolean;
public setPin(pin: number): void;
public delete(): void;
public patch(t: unknown): void;
public patchChanges(
t: unknown,
init?: { from: string },
): Promise<unknown>;
get hasSelfBackLink(): boolean;
public requestFetchApiCacheToServiceWorker(): unknown;
}