2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 07:40:55 +00:00
books/client/index.js

29 lines
868 B
JavaScript
Raw Normal View History

2018-01-16 06:09:17 +00:00
const common = require('frappejs/common');
2018-02-19 16:41:10 +00:00
const HTTPClient = require('frappejs/backends/http');
2018-01-16 06:09:17 +00:00
const frappe = require('frappejs');
2018-01-12 12:25:07 +00:00
frappe.ui = require('./ui');
const Desk = require('./desk');
module.exports = {
2018-02-14 16:44:50 +00:00
async start({server, columns = 2}) {
2018-01-12 12:25:07 +00:00
window.frappe = frappe;
frappe.init();
frappe.registerLibs(common);
frappe.registerModels(require('frappejs/models'));
frappe.registerModels(require('../models'));
2018-01-12 12:25:07 +00:00
frappe.fetch = window.fetch.bind();
2018-02-19 16:41:10 +00:00
frappe.db = await new HTTPClient({server: server});
this.socket = io.connect('http://localhost:8000'); // eslint-disable-line
frappe.db.bindSocketClient(this.socket);
frappe.flags.cacheDocs = true;
await frappe.getSingle('SystemSettings');
2018-01-12 12:25:07 +00:00
2018-02-14 16:44:50 +00:00
frappe.desk = new Desk(columns);
2018-01-12 12:25:07 +00:00
await frappe.login();
}
};