哪位高手解释解释代码,是否用到了回调机制
var context = {wm : (function() {return frameworkStruct ? frameworkStruct.fw.wm : null;})(),
tm : {
o : (function() {return frameworkStruct ? frameworkStruct.fw.tm : null;})(),
popupTask : function(task, button, fork, force) {
task.invokePathName = window.location.pathname;
this.o.popupTask(task, button, fork, force);
},
switchTask : function(task, second, force) {
this.o.switchTask(task, second, force);
},
closeTask : function(task, callback) {
this.o.closeTask(task, callback);
},
resetTask : function(task) {
this.o.resetTask(task);
}
},
//timer : (function() {return frameworkStruct ? frameworkStruct.fw.Timer : null;})(),
timer : {
tasks : {},
defautlInterval : 3000,
newTask : function (id, handle, immediately, period) {
if (this.tasks[id]) {
alert("Timer: taskid conflicted, id " + id + " is in use.");
return;
}
this.tasks[id] = {id : id, handle : handle, period : period ? period : this.defautlInterval, isRunning: false};
if (immediately)
this.startTask(id);
},
startTask : function (id) {
if (this.tasks[id] && !this.tasks[id].isRunning) {
this.tasks[id].isRunning = true;
this.tasks[id].intervalId = window.setInterval(this.tasks[id].handle, this.tasks[id].period);
}
},
stopTask : function (id) {
if (this.tasks[id] && this.tasks[id].isRunning) {
this.tasks[id].isRunning = false;
window.clearInterval(this.tasks[id].intervalId);
}
},
removeTask : function (id) {
this.stopTask(id);
delete this.tasks[id];
}
},
task : {},
desktop : {},
register : {},
initinal : function() {
if (this.wm && this.tm) {
if (frameworkStruct.tw.name) {
this.task = this.tm.o.findTaskById(frameworkStruct.tw.name);
}
if (this.task.id)
this.desktop = this.task.task.desktop;
else
this.desktop = this.wm.currentDesktop;
this.register = this.wm.register;
}
return this;
},
generateUID : function() {if(frameworkStruct) return frameworkStruct.fw.generateUID();},
setTitle : function(title) {
if (this.task && this.desktop && this.desktop.taskbar) {
this.desktop.taskbar.setButtonTitle(this.task.id, title);
}
}
}.initinal();