Reorganize js object SkyliveX

parent e4f6f169
function changeContent(id, content) function skyliveClass () {}
{ skyliveClass.prototype.method = function(name, func){
this.prototype[name] = func;
return this;
}
skyliveClass.method('changeContent', function(id, content){
var n=document.getElementById(id); var n=document.getElementById(id);
if(typeof(n)!="undefined") if(typeof(n)!="undefined")
n.innerHTML=content; n.innerHTML=content;
} });
function notify(content) skyliveClass.method('notify', function(content){
{
if(typeof(notifycb)=="function") if(typeof(notifycb)=="function")
notifycb(content); notifycb(content);
} });
function msgalert(content) skyliveClass.method('msgalert', function(content){
{
if(typeof(alertcb)=="function") if(typeof(alertcb)=="function")
alertcb(content); alertcb(content);
else //else
alert(content); // alert(content);
} });
function publicReceived(user, msg) skyliveClass.method('publicReceived', function(user, msg){
{
if(typeof(public_received)=="function") if(typeof(public_received)=="function")
{ {
public_received(user, msg); public_received(user, msg);
...@@ -31,9 +32,9 @@ function publicReceived(user, msg) ...@@ -31,9 +32,9 @@ function publicReceived(user, msg)
n.scollTop = n.scrollHeight; n.scollTop = n.scrollHeight;
} }
} }
} });
SkyliveX.page = new SkyliveClass();
SkyliveX.changeContent.connect(changeContent); SkyliveX.changeContent.connect(SkyliveX.page.changeContent);
SkyliveX.notify.connect(notify); SkyliveX.notify.connect(SkyliveX.page.notify);
SkyliveX.alertmsg.connect(msgalert); SkyliveX.alertmsg.connect(SkyliveX.page.msgalert);
SkyliveX.public_received.connect(publicReceived); SkyliveX.public_received.connect(SkyliveX.page.publicReceived);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment