资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

TypeScript的PureMVC框架之Facade类;

Facade类

facade类是pureMVC框架的单例类,Facade提供了与核心层通信的唯一接口

让客户满意是我们工作的目标,不断超越客户的期望值来自于我们对这个行业的热爱。我们立志把好的技术通过有效、简单的方式提供给客户,将通过不懈努力成为客户在信息化领域值得信任、有价值的长期合作伙伴,公司提供的服务项目有:域名注册网站空间、营销软件、网站建设、新乡县网站维护、网站推广。

以下是AppFacade单例类 继承自puremvc.Facade

static getInstance(facadeID:string = "AppFacade"):AppFacade
{
    if(!puremvc.Facade.instanceMap[facadeID])
    {
        puremvc.Facade.instanceMap
        puremvc.Facade.instanceMap["AppFacade"] = new AppFacade("AppFacade");
    }

    return puremvc.Facade.instanceMap["AppFacade"];
}

此类调用puremvc.Facade中的接口函数,通用方法如下: AppFacade.getInstance().sendNotification()

Facade类成员:
public model: IModel; ---------------------------------------------------------------------------------------------Model单例
public view: IView;--------------------------------------------------------------------------------------------------View单例
public controller: IController;-------------------------------------------------------------------------------------Controller单例
public multitonKey: string;----------------------------------------------------------------------------------------Facade单例创建后设置秘钥
constructor (key:string);-------------------------------------------------------------------------------------------构造函数
Facade类的成员函数:
public initializeFacade(): void;-----------------------------------------------------------------------------------初始化Facade单例
public initializeModel(): void;-------------------------------------------------------------------------------------Facade完成后初始化Model
public initializeController(): void;--------------------------------------------------------------------------------Facade完成后初始化Controller
public initializeView(): void;---------------------------------------------------------------------------------------Facade完成后初始化View

public registerCommand(notificationName: string, commandCla***ef: Function): void;---------注册命令,并设置一个命令的名字
public removeCommand(notificationName: string): void;-------------------------------------------------移除命令
public hasCommand(notificationName: string): boolean;-------------------------------------------------检测通知名是否注册命令

public registerProxy(proxy: IProxy): void;---------------------------------------------------------------------通过模型名注册代理
public retrieveProxy(proxyName: string): IProxy;-----------------------------------------------------------检索代理
public removeProxy(proxyName: string): IProxy;-----------------------------------------------------------移除代理
public hasProxy(proxyName: string): boolean;--------------------------------------------------------------检测代理是否注册

public registerMediator(mediator: IMediator): void;---------------------------------------------------------注册Mediator
public retrieveMediator(mediatorName: string): IMediator;-----------------------------------------------检索Mediator
public removeMediator(mediatorName: string): IMediator;-----------------------------------------------移除mediator
public hasMediator(mediatorName: string): boolean;------------------------------------------------------检测Mediator

public notifyObservers(notification: INotification):void;-----------------------------------------------------此方法主要用于向后兼容性,并允许您使用Facade来发送自定义通知类
public sendNotification(name: string, body?: any, type?: string):void;----------------------------------创建发送通知,实现通信
public initializeNotifier(key: string): void;-----------------------------------------------------------------------Facade单例创建后设置秘钥


标题名称:TypeScript的PureMVC框架之Facade类;
当前地址:http://cdkjz.cn/article/jhccgh.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220