auto subscribe to background_job when use bgapi

This commit is contained in:
Seven Du 2013-08-13 08:46:16 +08:00
parent 3901ff4ddd
commit f1540c6326
1 changed files with 7 additions and 1 deletions

View File

@ -716,11 +716,13 @@ App.usersController = Ember.ArrayController.create({
App.initialize();
var global_debug_event = false;
var global_background_job = false;
function eventCallback(data) {
console.log(data["Event-Name"]);
if (global_debug_event) {
if (global_debug_event ||
(global_background_job && data["Event-Name"] == "BACKGROUND_JOB")) {
console.log(data);
}
@ -800,6 +802,10 @@ function api(cmdstr)
//execute bgapi
function bgapi(cmd)
{
if (!global_background_job) {
socket.send("event json BACKGROUND_JOB");
global_background_job = true;
}
api("bgapi " + cmd);
}