A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
refactor: string event names to global event name consts
thecodrraec57340c337
diff --git a/packages/core/api/index.js b/packages/core/api/index.jsindex 83d6d22c5..6ca7412b7 100644--- a/packages/core/api/index.js+++ b/packages/core/api/index.js@@ -45,10 +45,10 @@ class Database {async init() {EV.subscribeMulti(- ["user:loggedIn", "user:loggedOut", "user:fetched"],+ [EVENTS.userLoggedIn, EVENTS.userLoggedOut, EVENTS.userFetched],this._onUserStateChanged.bind(this));- EV.subscribe("db:write", this._onDBWrite.bind(this));+ EV.subscribe(EVENTS.databaseUpdated, this._onDBWrite.bind(this));this.session = new Session(this.context);await this._validate();diff --git a/packages/core/api/settings.js b/packages/core/api/settings.jsindex 6f1cc5a06..4b7f3acf9 100644--- a/packages/core/api/settings.js+++ b/packages/core/api/settings.js@@ -1,4 +1,4 @@-import { EV } from "../common";+import { EV, EVENTS } from "../common";import id from "../utils/id";class Settings {@@ -33,7 +33,7 @@ class Settings {var settings = await this._db.context.read("settings");if (!settings) await this._db.context.write("settings", this._settings);else this._settings = settings;- EV.subscribe("user:loggedOut", () => {+ EV.subscribe(EVENTS.userLoggedOut, () => {this._settings = {type: "settings",id: id(),diff --git a/packages/core/api/vault.js b/packages/core/api/vault.jsindex 1924957b6..a09399d9b 100644--- a/packages/core/api/vault.js+++ b/packages/core/api/vault.js@@ -1,4 +1,4 @@-import { CHECK_IDS, EV, sendCheckUserStatusEvent } from "../common";+import { CHECK_IDS, EV, EVENTS, sendCheckUserStatusEvent } from "../common";import getId from "../utils/id";const ERASE_TIME = 1000 * 60 * 30;@@ -17,7 +17,7 @@ export default class Vault {vaultLocked: "ERR_VAULT_LOCKED",wrongPassword: "ERR_WRONG_PASSWORD",};- EV.subscribe("user:loggedOut", () => {+ EV.subscribe(EVENTS.userLoggedOut, () => {this._password = "";});}diff --git a/packages/core/collections/collection.js b/packages/core/collections/collection.jsindex 875201f7d..bbfd54f4c 100644--- a/packages/core/collections/collection.js+++ b/packages/core/collections/collection.js@@ -1,4 +1,4 @@-import { EV } from "../common";+import { EV, EVENTS } from "../common";import CachedCollection from "../database/cached-collection";import IndexedCollection from "../database/indexed-collection";@@ -11,7 +11,7 @@ class Collection {if (collection._collection.clear)EV.subscribe(- "user:loggedOut",+ EVENTS.userLoggedOut,async () => await collection._collection.clear());