-
Notifications
You must be signed in to change notification settings - Fork 0
/
Command.js
40 lines (34 loc) · 1.33 KB
/
Command.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
var command_stack = [];
var UserManager = (function(){
return {
requestInfo: function( user ){
// Could be determined
console.info( "checking info for : " + user );
},
followUser: function( user ){
console.info( "Following "+user+" comment" );
},
pingUser: function( user ){
console.info( "Checking for "+user );
}
}
})();
UserManager.execute = function(command ){
return UserManager[command.request](command["user"]);
};
(function(){
if( command_stack.length > 0 ){
command = command_stack.pop();
UserManager.execute( command );
}
setTimeout(arguments.callee, 1000);
})();
command_stack.push( { request: "pingUser", user: "apagano" } );
command_stack.push( { request: "followUser", user: "apaganobeleno" } );
command_stack.push( { request: "followUser", user: "apaganobeleno" } );
command_stack.push( { request: "followUser", user: "apaganobeleno" } );
command_stack.push( { request: "followUser", user: "apaganobeleno" } );
command_stack.push( { request: "followUser", user: "apaganobeleno" } );
command_stack.push( { request: "followUser", user: "apaganobeleno" } );
command_stack.push( { request: "followUser", user: "apaganobeleno" } );
command_stack.push( { request: "requestInfo", user: "apaganobeleno" } );