add api/bgapi event functions
This commit is contained in:
parent
3ec15cce68
commit
3901ff4ddd
|
@ -783,3 +783,30 @@ function eventCallback(data) {
|
|||
}
|
||||
}
|
||||
|
||||
// execute api
|
||||
function api(cmdstr)
|
||||
{
|
||||
cmdarr = cmdstr.split(" ");
|
||||
cmd = cmdarr.shift();
|
||||
arg = escape(cmdarr.join(" "));
|
||||
arg = arg ? "?" + arg : "";
|
||||
url = "/txtapi/" + cmd + arg;
|
||||
$.get(url, function(data){
|
||||
console.log(data);
|
||||
});
|
||||
return url;
|
||||
}
|
||||
|
||||
//execute bgapi
|
||||
function bgapi(cmd)
|
||||
{
|
||||
api("bgapi " + cmd);
|
||||
}
|
||||
|
||||
// subscribe event
|
||||
function event(e)
|
||||
{
|
||||
cmd = "event json " + e;
|
||||
socket.send(cmd);
|
||||
return cmd;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue