mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-21 14:09:34 +01:00
Merge branch 'master' into attachments
This commit is contained in:
19
packages/core/api/debug.js
Normal file
19
packages/core/api/debug.js
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
export default class Debug {
|
||||||
|
strip(item) {
|
||||||
|
return JSON.stringify({
|
||||||
|
title: !!item.title,
|
||||||
|
description: !!item.description,
|
||||||
|
headline: !!item.headline,
|
||||||
|
colored: !!item.color,
|
||||||
|
type: item.type,
|
||||||
|
notebooks: item.notebooks,
|
||||||
|
tags: item.tags,
|
||||||
|
id: item.id,
|
||||||
|
contentId: item.contentId,
|
||||||
|
dateEdited: item.dateEdited,
|
||||||
|
dateDeleted: item.dateDeleted,
|
||||||
|
dateCreated: item.dateCreated,
|
||||||
|
additionalData: item.additionalData,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -21,6 +21,7 @@ import http from "../utils/http";
|
|||||||
import Monographs from "./monographs";
|
import Monographs from "./monographs";
|
||||||
import Offers from "./offers";
|
import Offers from "./offers";
|
||||||
import Attachments from "../collections/attachments";
|
import Attachments from "../collections/attachments";
|
||||||
|
import Debug from "./debug";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {EventSource}
|
* @type {EventSource}
|
||||||
@@ -51,7 +52,8 @@ class Database {
|
|||||||
async init() {
|
async init() {
|
||||||
EV.subscribeMulti(
|
EV.subscribeMulti(
|
||||||
[EVENTS.userLoggedIn, EVENTS.userFetched, EVENTS.tokenRefreshed],
|
[EVENTS.userLoggedIn, EVENTS.userFetched, EVENTS.tokenRefreshed],
|
||||||
this.connectSSE.bind(this)
|
this.connectSSE,
|
||||||
|
this
|
||||||
);
|
);
|
||||||
EV.subscribe(EVENTS.attachmentDeleted, async (attachment) => {
|
EV.subscribe(EVENTS.attachmentDeleted, async (attachment) => {
|
||||||
console.log("deleted:", attachment);
|
console.log("deleted:", attachment);
|
||||||
@@ -81,6 +83,7 @@ class Database {
|
|||||||
this.outbox = new Outbox(this);
|
this.outbox = new Outbox(this);
|
||||||
this.monographs = new Monographs(this);
|
this.monographs = new Monographs(this);
|
||||||
this.offers = new Offers();
|
this.offers = new Offers();
|
||||||
|
this.debug = new Debug();
|
||||||
|
|
||||||
// collections
|
// collections
|
||||||
/** @type {Notes} */
|
/** @type {Notes} */
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ class EventManager {
|
|||||||
this._registry.clear();
|
this._registry.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
subscribeMulti(names, handler) {
|
subscribeMulti(names, handler, thisArg) {
|
||||||
names.forEach((name) => {
|
names.forEach((name) => {
|
||||||
this.subscribe(name, handler);
|
this.subscribe(name, handler.bind(thisArg));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user