注册 登录
编程论坛 WEB前端(UI)

js文件看不懂,大侠指点,万谢

西鄙人 发布于 2011-02-16 10:00, 1783 次点击
这是一个叫resources.js的文件,其中的this.resources等不知引用是什么?

/*
 * 资源工厂,定义消息资源。
 * 在ResourceFactory_CreateInstance函数里定义每一个消息。
 *
 * $Id$
 */
function ResourceFactory() {
    this.resources = {};
    this.constants = {};
    this.getResource = ResourceFactory_GetResource;
    this.getConstant = ResourceFactory_GetConstant;
    this.createInstance = ResourceFactory_CreateInstance;
    this.init = ResourceFactory_Init;
}

function ResourceFactory_GetResource(name) {
    return this.resources[name] ? this.resources[name] : this.resources['hoo'];
}

function ResourceFactory_GetConstant(name) {
    return this.constants[name] ? this.constants[name] : this.constants['hoo'];
}

function ResourceFactory_CreateInstance() {
    this.resources['hoo'] = "内部错误";
    this.constants['hoo'] = "";
    this.init();
    return this;
}

function ResourceFactory_Init() {
    this.resources['WM_nowidget'] = "没有这个窗口部件对象:";
    this.resources['WM_nodesktop'] = "没有这个桌面对象:";
    this.resources['TM_confirm_switchchildtask'] = "当前任务正在运行,并且有未完成的子任务,不能关闭,请先处理子任务。\n现在切换到子任务吗?";
    this.resources['Timer_taskidconflicted'] = "定时任务ID冲突,该任务ID已使用。任务ID:";
    this.resources['MENU_confirmlogout'] = "您将退出本次登录重新登录系统,确认吗?";
    this.resources['MENU_confirmclose'] = "您将退出系统,确认吗?";
    this.resources['TP_notasktarget'] = "没有设定任务目标(url or formObj)。";
    this.resources['TP_invoketaskinitialize'] = "调用任务生命周期方法__taskInitialize出错:";
    this.resources['TP_invoketaskpresent'] = "调用任务生命周期方法__taskPresent出错:";
    this.resources['TP_invoketaskreactive'] = "调用任务生命周期方法__taskReactive出错:";
    this.resources['TP_invoketaskfinalize'] = "调用任务生命周期方法__taskFinalize出错:";
    this.resources['MessageInfoSuffix'] = " 条新消息";
    this.resources['WM_errorinitwidgets'] = "初始化界面失败,请检查screen-layout.xml配置,错误信息:";
    this.resources['WM_elementlayoutcallbackerror'] = "调用部件自定义Ajax脚本出错,请检查screen-layout.xml配置,错误信息:";
    this.resources['TM_closetaskerror'] = "关闭任务出错,请检查自定义回调方法或传入的linkage对象,错误信息:";

    this.constants['default_task_icon'] = "ui/images/www7.gif";
    this.constants['default_loading_page'] = "ui/loading.jsp";
    this.constants['logout_method'] = "/login.do?method=logout";
}
5 回复
#2
gupiao1752011-03-03 00:26
抱歉看不懂。
#3
cnfarer2011-03-11 07:53
JS的“类”,我把它称之为伪类。
#4
shuyou2011-04-05 23:28
  楼上可以谈谈自己的见解吗?
#5
w1230123062011-04-18 10:35
基础部牢固!
#6
搞钱2021-01-03 15:58
this.resources = {};
    this.constants = {};
    this.getResource = ResourceFactory_GetResource;
    this.getConstant = ResourceFactory_GetConstant;
    this.createInstance = ResourceFactory_CreateInstance;
    this.init = ResourceFactory_Init;
这是将后面的赋给前面的
1