fe-lib-lottery-node
v1.2.22
Published
Nodejs library to control lottery machine
Downloads
18
Readme
fe-lib-lottery-node
Nodejs library to control lottery machine
- npm install
- node index.backup.js [targetIP] [targetMCUDesignType] [loop]
How to setup
- npm install fe-lib-lottery-node
- npm install node-loader (https://www.npmjs.com/package/node-loader)
- add
to webpack.config.js in module -> rules{ test: /\.node$/, use: 'node-loader' }
- npm i -D electron-rebuild
- run -------------> ./node_modules/.bin/electron-rebuild <--------------- (4-5 ref: https://github.com/serialport/node-serialport/issues/1910)
- set -------------> app.allowRendererProcessReuse = false; <--------------- in main
How to Use the library in electron or nodejs app
import LotteryControl from 'fe-lib-lottery-node'
or
const LotteryControl = require('fe-lib-lottery-node')
var lotteryControlF5 = new LotteryControl()
lotteryControlF5.main("192.168.167.131", "F5", "0", 100)
setInterval(lotteryControlF5.execute, 0)
var listenerToLib = async (msg) => {
console.log(msg);
}
// add listener
lotteryControlF5.eventEmitter.addListener('socket_message', listenerF5)
// remove listener
lotteryControlF5.eventEmitter.removeListener('receive_balls', listenerF5)
// var lotteryControlF3 = new LotteryControl()
// lotteryControlF3.main("192.168.167.143", "F3", "1", 100)
// setInterval(lotteryControlF3.execute, 0)
// var listenerF3 = function listenerF3(ball1, ball2, ball3) {
// console.log(ball1);
// console.log(ball2);
// console.log(ball3);
// }
// lotteryControlF3.eventEmitter.addListener('receive_balls', listenerF3)
// lotteryControlF3.eventEmitter.removeListener('receive_balls', listenerF3)
// var lotteryControlF1 = new LotteryControl()
// lotteryControlF1.main("192.168.167.101", "F1", "1", 100)
// setInterval(lotteryControlF1.execute, 0)
// var listenerF1 = function listenerF1(ball1, ball2, ball3, ball4, ball5, ball6, ball7) {
// console.log(ball1);
// console.log(ball2);
// console.log(ball3);
// console.log(ball4);
// console.log(ball5);
// console.log(ball6);
// console.log(ball7);
// }
// lotteryControlF1.eventEmitter.addListener('receive_balls', listenerF1)
// lotteryControlF1.eventEmitter.removeListener('receive_balls', listenerF1)
// var lotteryControlF2 = new LotteryControl()
// lotteryControlF2.main("192.168.167.111", "F2", "1", 100)
// setInterval(lotteryControlF2.execute, 0)
// var listenerF2 = function listenerF2(ball1, ball2, ball3, ball4, ball5) {
// console.log(ball1);
// console.log(ball2);
// console.log(ball3);
// console.log(ball4);
// console.log(ball5);
// }
// lotteryControlF2.eventEmitter.addListener('receive_balls', listenerF2)
// lotteryControlF2.eventEmitter.removeListener('receive_balls', listenerF2)