lbry-desktop/src/renderer/app.js

34 lines
577 B
JavaScript
Raw Normal View History

2017-12-14 09:58:07 -03:00
import store from "store";
import { remote } from "electron";
2017-12-14 09:58:07 -03:00
import path from "path";
2017-12-06 13:32:21 -03:00
const env = process.env.NODE_ENV || "production";
const config = {
...require(`./config/${env}`),
};
2017-06-20 08:08:52 -04:00
const i18n = require("y18n")({
2017-12-14 09:58:07 -03:00
directory: path
.join(remote.app.getAppPath(), "/../static/locales")
.replace(/\\/g, "\\\\"),
2017-06-20 08:08:52 -04:00
updateFiles: false,
2017-09-06 21:53:42 -04:00
locale: "en",
2017-06-05 21:21:55 -07:00
});
2017-12-13 18:36:30 -03:00
2017-04-07 12:15:22 +07:00
const logs = [];
const app = {
2017-12-13 18:36:30 -03:00
env,
config,
store,
i18n,
logs,
log(message) {
2017-06-20 08:08:52 -04:00
logs.push(message);
},
2017-06-05 21:21:55 -07:00
};
2016-11-22 14:19:08 -06:00
window.__ = i18n.__;
window.__n = i18n.__n;
2017-04-07 12:15:22 +07:00
global.app = app;
module.exports = app;