Official casync.js:www.cityooh.com
C_async.js is a free, JQ-based development framework that helps you to modularize subsets of features, quickly build single-page Web applications, assemble common features in daily RIA Development, and customize the import based on actual project requirements.
At present, Casync.js introduces the concept of page and define, which is a modular loader similar to sea.js, which can greatly facilitate developers to divide the project structure.
The following is a simple example:
First, you need to introduce some of the following files
Config.js (function ($) {var $g = window. $g = {modules: $c. Page ("Body"), {home: "Js/home.js", Pageone: "Js/pageone. JS ", Pagetwo:" Js/pagetwo.js ", Pagetre:" Js/pagetre.js "}), Plugin: $c. Page ({pluginone:" Js/plugin/pluginone.js ", Plugintwo: "Js/plugin/plugintwo.js", Pluginthr: "Js/plugin/pluginthr.js"}), Global: $c. Page ({configone: "js/config/ Configone.js "})}; $g. Modules.home.display (function () {Console.log (" Home ");}); $g. Global.configOne.get (function () {Console.log ($g. global.configone);}); ) (JQuery);
Home.js$c.define ({//Here is page it for the Declaration page module page: $g. Modules.home,//url inject the current JS specific implementation of the dependency file URL: ["Js/homeone.js", "Js/ho Metwo.js "," Css/home.min.css "," page/home.html "],constructor:function () {var self = This;self.say ();//return is thrown out The method set is similar to the role of exports in node. js in return {tell:function () {Self.say ();}};}} );
Homeone.js$c.define ({//here for parent it points to its own parent pageparent: $g. Modules.home,url: ["Js/homethr.js"],constructor: function () {var = this;return {say:function () {console.log (self);}};} );
A hierarchical relationship is introduced in the code above homeone.js is a member of the Home.js.
Home.js can call Homeone inside and out. Of course you can also use $g in other modules. Modules.home.say (); To be used
If you want the method in the child to be used only internally you can also return in the parent = {Say:null}
So that it can disable the external module to use it
No constraints on development methods in Casync.js you can divide the management of the module arbitrarily
In the example above, I divided the project into the page layer (modules), the plug-in (plugin), the configuration layer (global)
You can also set the developer's personal preferences to MVC, and so on
For more information, refer to the official: www.cityooh.com