How to Use the PureMVC framework of javascript-Command

Source: Internet
Author: User
The Controller saves the Command ing of all commands. The Command class is stateless and is created only when needed. Command is responsible for processing complex data logic. Its use is summarized in two ways. 1. send Notification to trigger Command2.addSubCommand ()... SyntaxHi

The Controller saves the Command ing of all commands. The Command class is stateless and is created only when needed.

Command is responsible for processing complex data logic. Its use is summarized in two ways.

1. trigger Command by sending Notification

2. addSubCommand () to start

 

Let's get started right away.

 

Create a controller folder under the demo folder, and create a js file named StartupCommand. js under the controller folder. Enter the following content

[Javascript]
Var StartupCommand = Objs ("sweeps. controller. StartupCommand ",
MacroCommand,
{
/**
* @ Override
* Add Subcommands to start the PuerMVC component.
* Generally, the Model (Proxy) and View (Mediators) are prepared first );
*/
Initializemedia command: function (note)
{
Alert ('Received from facade ');
// This. addSubCommand (PrepModelCommand );
// This. addSubCommand (PrepViewCommand );
}

});
Create a folder abc under the demo folder to store Noticefiction, create the NotificationNames. js file under the abc folder, and enter the following content

[Javascript]
Var icationicationnames = Objs ("demo. abc. NotificationNames ",{});
 
Icationicationnames. STARTUP = "startup ";
Import the StartupCommand. js and icationicationnames. js files in the html file.

[Html] view plaincopyprint?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.