-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathecho.js
More file actions
24 lines (23 loc) · 745 Bytes
/
echo.js
File metadata and controls
24 lines (23 loc) · 745 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
"use strict";
var packet = require('gearman-packet');
exports.echo = function (options, data, onComplete) {
if (onComplete == null && typeof data == 'function') {
onComplete = data;
data = void 0;
}
if (data == null && options != null && (options.pipe || options.length)) {
data = options;
options = {};
}
if (data==null && onComplete == null && typeof options == 'function') {
onComplete = options;
options = void 0;
}
return this.startTask(onComplete, options, function (task) {
task.prepareBody(data, function(body) {
task.conn.echo(body, function (result) {
task.acceptResult(result.body);
});
});
});
}