1. 程式人生 > >JavaScript的PureMVC框架之Facade類;

JavaScript的PureMVC框架之Facade類;

pure app instance 通用方法 javascrip cad pre ica rem

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 <AppFacade>puremvc.Facade.instanceMap["AppFacade"];
}

此類調用puremvc.Facade中的接口函數,通用方法如下: AppFacade.getInstance().sendNotification()

JavaScript的PureMVC框架之Facade類;