forked from iblislin/node-dde
-
Notifications
You must be signed in to change notification settings - Fork 1
/
client.js
74 lines (62 loc) · 1.87 KB
/
client.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
var Clients = require('./clients.js').Clients;
function Client(service, topic) {
var services = {};
services[service] = {};
services[service][topic] = null;
Clients.call(this, services);
}
Client.prototype.poke = function(item, data, timeout) {
this.item = item;
Clients.prototype.poke.call(this, data, timeout);
};
Client.prototype.request = function(item, format, timeout) {
this.item = item;
return Clients.prototype.request.call(this, format, timeout);
};
Client.prototype.startAdvise = function(item, format, hot, timeout) {
this.item = item;
Clients.prototype.startAdvise.call(this, format, hot, timeout);
};
Client.prototype.stopAdvise = function(item, timeout) {
this.item = item;
Clients.prototype.stopAdvise.call(this, timeout);
};
Client.prototype.beginExecute = function(command, oncomplete) {
this._invoke({
method: 'BeginExecute',
command: command || this.command,
}, oncomplete);
};
Client.prototype.beginPoke = function(item, data, format, oncomplete) {
this._invoke({
method: 'BeginPoke',
item: item || this.item,
data: data || this.data,
format: format || this.format,
}, oncomplete);
};
Client.prototype.beginRequest = function(item, format, oncomplete) {
this._invoke({
method: 'BeginRequest',
item: item || this.item,
format: format || this.format,
}, oncomplete);
};
Client.prototype.beginStartAdvise = function(item, format, hot, oncomplete) {
this._invoke({
method: 'BeginStartAdvise',
item: item || this.item,
format: format || this.format,
hot: hot || this.hot,
}, oncomplete);
};
Client.prototype.beginStopAdvise = function(item, oncomplete) {
this._invoke({
method: 'BeginStopAdvise',
item: item || this.item,
}, oncomplete);
};
Client.prototype.__proto__ = Clients.prototype;
exports.createClient = function(service, topic) {
return new Client(service, topic);
};