From 2a6dc63487f58fc64fc37956b499452891fbd72f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Renaudeau?= Date: Wed, 10 Oct 2018 13:32:07 +0200 Subject: [PATCH] Add access to db,commands,store in the console --- src/commands/index.js | 3 +++ src/renderer/init.js | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/src/commands/index.js b/src/commands/index.js index fad516a6..1022021c 100644 --- a/src/commands/index.js +++ b/src/commands/index.js @@ -69,8 +69,11 @@ const all: Array> = [ uninstallApp, ] +export const commandsById = {} + all.forEach(cmd => { invariant(!all.some(c => c !== cmd && c.id === cmd.id), `duplicate command '${cmd.id}'`) + commandsById[cmd.id] = cmd }) export default all diff --git a/src/renderer/init.js b/src/renderer/init.js index 4f7278df..0cd10074 100644 --- a/src/renderer/init.js +++ b/src/renderer/init.js @@ -18,6 +18,7 @@ import { fetchAccounts } from 'actions/accounts' import { fetchSettings } from 'actions/settings' import { lock } from 'reducers/application' import { languageSelector, sentryLogsSelector } from 'reducers/settings' +import { commandsById } from 'commands' import libcoreGetVersion from 'commands/libcoreGetVersion' import resolveUserDataDirectory from 'helpers/resolveUserDataDirectory' @@ -111,6 +112,14 @@ async function init() { }, false, ) + + // expose stuff in Windows for DEBUG purpose + + window.ledger = { + commands: commandsById, + store, + db, + } } function r(Comp) {