-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathexample.js
48 lines (41 loc) · 1.35 KB
/
example.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
* Copyright © 2018-20 LiquidPlayer
*
* Released under the MIT license.
* See https://github.com/LiquidPlayer/LiquidCore/LICENSE.md for terms.
*/
/* Hello, World! */
const {LiquidCore} = require('liquidcore')
// A micro service will exit when it has nothing left to do. So to
// avoid a premature exit, set an indefinite timer. When we
// exit() later, the timer will get invalidated.
setInterval(()=>{}, 1000)
console.log('Hello, World!')
// Listen for a request from the host for the 'ping' event
LiquidCore.on( 'ping', (data) => {
// When we get the ping from the host, respond with "Hello, World!"
// and then exit.
// console.log("from local," +data.hallo)
// LiquidCore.emit( 'pong', { message: 'Hello, World from LiquidCore!' } )
// process.exit(0)
})
LiquidCore.on( 'pingPair', (data) => {
console.log("pair," +data.pair)
})
LiquidCore.on( 'pingConnect', (data) => {
console.log("connect," + data.connect)
})
LiquidCore.on( 'pingVolPlus', (data) => {
console.log("volPlus," + data.volPlus)
})
LiquidCore.on( 'pingVolMinus', (data) => {
console.log("volMinus," + data.volMinus)
})
LiquidCore.on( 'pingMenu', (data) => {
console.log("menu," + data.menu)
})
LiquidCore.on( 'pingHome', (data) => {
console.log("home," + data.home)
})
// Ok, we are all set up. Let the host know we are ready to talk
LiquidCore.emit( 'ready' )