-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtransaction-nested-multi-example.js
43 lines (39 loc) · 1.3 KB
/
transaction-nested-multi-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
/*
* Spade MONITOR Example
*/
var log = console.log
, util = require( 'util' )
, Spade = require( '../' )
, client = Spade()
, cback = function ( err, data, fn ) {
log( 'ex.: cback gets:', err, fn( data[ 0 ] ) );
}
, i = 0
;
client.on( 'error', function ( ocmd ) {
log( 'error', ocmd );
} );
client.on( 'ready', function () {
client.commands.multi( function ( err, data, fn ) {
log( 'multi:', fn( data ) );
setTimeout( function () {
client.commands.ping( function ( err, data, fn ) {
log( 'ping:', fn( data ) );
setTimeout( function () {
client.commands.multi( function ( err, data, fn ) {
log( 'multi:', fn( data ) );
setTimeout( function () {
client.commands.exec( function ( err, data, fn ) {
log( 'exec:', fn( data ) );
client.commands.quit( function ( err, data, fn ) {
log( 'quit:', fn( data ) );
} );
} );
}, 2000 );
} );
}, 2000 );
} );
}, 2000 );
} );
} );
client.connect();