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();
|
2018-02-16 13:13:46 +00:00
|
|
|
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);
|
2018-01-15 11:55:31 +00:00
|
|
|
|
|
|
|
frappe.flags.cache_docs = true;
|
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();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|