mirror of
https://github.com/frappe/books.git
synced 2024-11-14 01:14:03 +00:00
Add electron client
This commit is contained in:
parent
3e5c6fec43
commit
555fcfeda8
36
client/electron.js
Normal file
36
client/electron.js
Normal file
@ -0,0 +1,36 @@
|
||||
const common = require('frappejs/common');
|
||||
const sqlite = require('frappejs/backends/sqlite');
|
||||
const frappe = require('frappejs');
|
||||
frappe.ui = require('./ui');
|
||||
const Desk = require('./desk');
|
||||
const Observable = require('frappejs/utils/observable');
|
||||
|
||||
module.exports = {
|
||||
async start({dbPath, columns = 3, models}) {
|
||||
window.frappe = frappe;
|
||||
frappe.init();
|
||||
|
||||
frappe.registerLibs(common);
|
||||
frappe.registerModels(require('frappejs/models'));
|
||||
|
||||
if (models) {
|
||||
frappe.registerModels(models);
|
||||
}
|
||||
|
||||
frappe.db = await new sqlite({ dbPath });
|
||||
await frappe.db.connect();
|
||||
await frappe.db.migrate();
|
||||
|
||||
frappe.fetch = window.fetch.bind();
|
||||
|
||||
frappe.docs = new Observable();
|
||||
|
||||
await frappe.getSingle('SystemSettings');
|
||||
|
||||
frappe.desk = new Desk(columns);
|
||||
await frappe.login();
|
||||
|
||||
return frappe;
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user