forked from qlik-oss/halyard.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
inline-data.js
32 lines (22 loc) · 876 Bytes
/
inline-data.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const fs = require('fs');
const path = require('path');
const enigmaConfig = require('./enigma-config.js');
const enigma = require('enigma.js');
const enigmaMixin = require('../dist/halyard-enigma-mixin.js');
enigmaConfig.mixins = enigmaMixin;
const Halyard = require('../dist/halyard.js');
const filePath = path.join(__dirname, './data/carmakers.json');
fs.readFile(filePath, 'utf8', (err, data) => {
const halyard = new Halyard();
const table = new Halyard.Table(JSON.parse(data), 'Car Makers');
halyard.addTable(table);
enigma.getService('qix', enigmaConfig).then((qix) => {
const appName = `Inline-Data-${Date.now()}`;
qix.global.createAppUsingHalyard(appName, halyard).then((result) => {
console.log(`App created and reloaded - ${appName}.qvf`);
process.exit(appName);
}, (error) => {
console.log(error);
});
});
});