-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathrender.js
More file actions
31 lines (27 loc) · 870 Bytes
/
render.js
File metadata and controls
31 lines (27 loc) · 870 Bytes
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
// renderer.js
var thrift = require('thrift');
// 调用win10下thrift命令自动生成的依赖包
var userService = require('./gen-nodejs/userService.js');
var ttypes = require('./gen-nodejs/test_types.js');
var thriftConnection = thrift.createConnection('127.0.0.1', 8000);
var thriftClient = thrift.createClient(userService,thriftConnection);
thriftConnection.on("error",function(e)
{
console.log(e);
});
/* var client = new zerorpc.Client();
client.connect("tcp://127.0.0.1:4242"); */
let name = document.querySelector('#name')
let result = document.querySelector('#result')
name.addEventListener('input', () => {
var dic = {name: name.value}
dic = JSON.stringify(dic)
thriftClient.test1(dic, (error, res) => {
if(error) {
console.error(error)
} else {
result.textContent = res
}
})
})
name.dispatchEvent(new Event('input'))