AMD that Asynchronous Module Definition is, the Chinese name is the meaning of "async module definition". It is a specification for modular development in the browser-side, and the server- CommonJS。 side specification is模块将被异步加载,模块加载不影响后面语句的运行。所有依赖某些模块的语句均放置在回调函数中。 AMD is the RequireJS normalized output defined for the
With the development of JS Modular programming, the dependence between the processing modules becomes the key to maintain.Amd,cmd,commonjs is currently the most commonly used three modular writing specifications.CommonJSThe COMMONJS specification was born earlier. node. JS (which is a JavaScript runtime) uses COMMONJS. This is how the module is loaded:Foo.jsmodule. Exports=function (X{console. Log (X;}; Mai
Modular specificationConcept: According to the different functions we write according to different types of division, collaborationRole: The role of auxiliary, can write our good JS into modules, is our code to write more professionalCome on JSThe introduction of the module is synchronous: The previous record, the latter can be used, so it is not suitable for the front end, mainly for the background nodejs with the mostAmdConcept: A async, M
After the ES6 standard is released, module becomes the standard, the standard use is to export the interface with export instruction, import into the module, but in our usual node module, we use the COMMONJS specification, using require to introduce the module, Export the in
the basic principles of the software.
FAQ's description.
The role of the Readme is as if the user manual is a smart way to write the document, which is often written at the end of the project.Because of the existence of the software directory structure, it is unavoidable that cross-catalog Import module exists .Module IntroductionLearn a few concepts first:
AMD cmd differencesConcept:Yuber's explanation for the difference between AMD and CMD: AMD is a normalized output of the module defined by REQUIREJS during the promotion process.CMD is the normalized output of the module defined by SEAJS in the process of generalization. AMD It is a modular development in the browser-side specification asynchronous
AMD Spec:Https://github.com/amdjs/amdjs-api/wiki/AMDThis specification defines only a function "define", which is a global variable. The description of the function is:Define (ID?, dependencies, Factory);The first parameter, ID, is a string. It refers to the name of the module in the definition, and this parameter is optional. If this parameter is not provided, the modu
1 #/usr/bin/python2 #-*-coding=utf-8-*-3 4 """This was a standard module"""5 6 ImportSYS7 8 __author__='Wang'9 Ten One defTest (): Aargs =sys.argv () - ifLen (args) = = 1: - Print('Hello world!') the elifLen (args) = = 2: - Print('Hello%s!'% args[1]) - Else: - Print('Too many arguments!') + - + if __name__=='__main__': ATest ()1, the first line of code under the Linux and Mac systems, the script can be run direct
1. What is ModularFile scopeCommunication rulesLoad requireExport exports2, COMMONJS module specificationJavaScript in node also has a very important concept: module conceptModule scopeUse the Require method to load a moduleSyntax: var custom variable name = require (' module ')Two functions:Executing the code in the loaded moduleGet the exports export interface
1. Error:
When running-> run on server is used in eclipse, selecting Tomcat 6 will report an error: the server does not support version 3.0 of the J2EE Web module specification 2. cause:
Tomcat 6.0 supports up to servlet 2.5, but now the project to be imported is version 3.0. 3. solution:
There is a. settings folder under the root directory of the Project, which contains an org. Eclipse. WST. Common. Pro
are divided into two lines to write.( 6 ) functions and functions must be separated by two lines of line breaks. Static ngx_chain_t * Ngx_tfs_ms_create_read_packet (ngx_http_tfs_t *t) {}Static ngx_chain_t * Ngx_tfs_ms_create_write_packet (ngx_http_tfs_t *t)(7) forLooping format: there should be a space between the variable and the semicolon, followed by curly braces and foron one line. ifthe format and forsimilar. all theifmust have parentheses and cannot omit curly braces. for (i = 0; i ......
When developing a struts2 project using eclipse today, right-click Run on server and the following message appears:
The server does not support edition 3.0 of the J2EE Web module specification
Tomcat 6.0 is used to create this project. JDK 1.6 is used, while Tomcat 6.0 supports servlet 2.5.
Find a solution on the Internet and share the following:
There is. SettingsFolder, which hasOrg. Eclipse
Index9.htmlOne of the loaders here implements the COMMONJS specification, which is exactly the same as the Nodejs module loaderModule definitionExports.txt = "Hello word"; module.exports={ "name": "Zhang San"}Require loading this require ("./xxx.html!text");Require loading CSS require ("./xxx.css!css");Default loading JS, and loading JS can omit the suffix nameThere are no rules for COMMONJS to be found
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.