Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/src/layout/Model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class Model {
id: string,
type?: TWS,
callback?: () => void,
msgCallback?: (data: IWebSocketData) => void
msgCallback?: (this: Model, data: IWebSocketData) => void
}) {
this.app = options.app;
if (options.msgCallback) {
Expand All @@ -34,7 +34,7 @@ export class Model {
id: string,
type?: TWS,
callback?: () => void,
msgCallback?: (data: IWebSocketData) => void
msgCallback?: (this: Model, data: IWebSocketData) => void
}) {
const websocketURL = `${window.location.protocol === "https:" ? "wss" : "ws"}://${window.location.host}/ws`;
const ws = new WebSocket(`${websocketURL}?app=${Constants.SIYUAN_APPID}&id=${options.id}${options.type ? "&type=" + options.type : ""}`);
Expand Down
2 changes: 1 addition & 1 deletion app/src/layout/dock/Backlink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class Backlink extends Model {
});
}
},
msgCallback(data) {
msgCallback(this: Backlink, data) {
if (data && this.type === "local") {
switch (data.cmd) {
case "rename":
Expand Down
6 changes: 3 additions & 3 deletions app/src/layout/dock/Bookmark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class Bookmark extends Model {
super({
app,
id: tab.id,
msgCallback(data) {
msgCallback(this: Bookmark, data) {
if (data) {
switch (data.cmd) {
case "transactions":
Expand All @@ -33,7 +33,7 @@ export class Bookmark extends Model {
needReload = true;
}
if (needReload) {
(this as Bookmark).update();
this.update();
}
});
break;
Expand All @@ -42,7 +42,7 @@ export class Bookmark extends Model {
case "removeDoc":
case "mount":
if (data.cmd !== "mount" || data.code !== 1) {
(this as Bookmark).update();
this.update();
}
break;
}
Expand Down
4 changes: 2 additions & 2 deletions app/src/layout/dock/Files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class Files extends Model {
app: options.app,
type: "filetree",
id: options.tab.id,
msgCallback(data) {
msgCallback(this: Files, data) {
if (data) {
switch (data.cmd) {
case "reloadDocInfo":
Expand All @@ -61,7 +61,7 @@ export class Files extends Model {
});
break;
case "mount":
this.onMount(data);
this.onMount(data as { data: { box: INotebook; existed?: boolean }; callback?: string });
options.app.plugins.forEach((item) => {
item.eventBus.emit("opened-notebook", data);
});
Expand Down
2 changes: 1 addition & 1 deletion app/src/layout/dock/Graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class Graph extends Model {
});
}
},
msgCallback(data) {
msgCallback(this: Graph, data) {
if (data) {
switch (data.cmd) {
case "mount":
Expand Down
2 changes: 1 addition & 1 deletion app/src/layout/dock/Outline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class Outline extends Model {
});
}
},
msgCallback(data) {
msgCallback(this: Outline, data) {
if (data) {
switch (data.cmd) {
case "savedoc":
Expand Down
2 changes: 1 addition & 1 deletion app/src/layout/dock/Tag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class Tag extends Model {
super({
app,
id: tab.id,
msgCallback(data) {
msgCallback(this: Tag, data) {
if (data) {
switch (data.cmd) {
case "transactions":
Expand Down
4 changes: 2 additions & 2 deletions app/src/mobile/dock/MobileFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class MobileFiles extends Model {
app,
id: genUUID(),
type: "filetree",
msgCallback(data) {
msgCallback(this: MobileFiles, data) {
if (data) {
switch (data.cmd) {
case "moveDoc":
Expand All @@ -42,7 +42,7 @@ export class MobileFiles extends Model {
});
break;
case "mount":
this.onMount(data);
this.onMount(data as { data: { box: INotebook; existed?: boolean }; callback?: string });
break;
case "createnotebook":
setNoteBook((notebooks) => {
Expand Down
2 changes: 1 addition & 1 deletion app/src/mobile/dock/MobileOutline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class MobileOutline extends Model {
super({
app: options.app,
id: genUUID(),
msgCallback(data) {
msgCallback(this: MobileOutline, data) {
if (data) {
switch (data.cmd) {
case "savedoc":
Expand Down
Loading