-
Notifications
You must be signed in to change notification settings - Fork 3
/
extension.js
32 lines (26 loc) · 887 Bytes
/
extension.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
'use strict';
module.exports = function (nodecg) {
const axios = require('axios');
const fs = require('fs');
const path = require('path');
const filePath = path.join(__dirname, 'shared/cards.json');
const leftInitialValue = {
img: ""
};
const rightInitialValue = {
img: ""
};
const soloInitialValue = {
img: ""
};
const r_leftCard = nodecg.Replicant('leftCard', { defaultValue: leftInitialValue });
const r_rightCard = nodecg.Replicant('rightCard', { defaultValue: rightInitialValue });
const r_soloCard = nodecg.Replicant('soloCard', { defaultValue: soloInitialValue });
fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
if (!err) {
const cards = nodecg.Replicant('cards').value = JSON.parse(data);
} else {
console.log(err);
}
});
};