| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 551 人关注过本帖
标题:哪位高手解释解释代码,是否用到了回调机制
只看楼主 加入收藏
西鄙人
Rank: 2
等 级:论坛游民
帖 子:36
专家分:12
注 册:2009-12-2
结帖率:100%
收藏
 问题点数:0 回复次数:0 
哪位高手解释解释代码,是否用到了回调机制
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();
搜索更多相关主题的帖子: function return button second null 
2012-03-28 13:46
快速回复:哪位高手解释解释代码,是否用到了回调机制
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.012456 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved