GWT has a cool feature named Code Splitting which loads parts of the code on demand. This is also appliable for webmake.
Here my idea:
// a.js: var b = require("b"); // ... bindEventHandlerForSomeRarEvent(function() { // the magic keyword "process.nextTick", which behaves normally in node.js // but so some special thing in webmake process.nextTick(function(err) { // Some code loading err handler // err is undefined in node.js if(err) { /* ... */ } var c = require("c"); // really big libary, which is only needed in this rar case // ... }); });
webmake core would provide the magic process.nextTick
function to the compiled code.process.nextTick
do this in the compiled code:
Here is a quick hint on the compiled files:
// output.js ( /* core code */ ({ "a": function(/* ... */, process) { // a.js: var b = require("b"); // ... bindEventHandlerForSomeRarEvent(function() { // the magic keyword, which behaves normally in node.js // but so some special thing in webmake process.nextTick(function(err) { // Some code loading err handler // err is undefined in node.js if(err) { /* ... */ } var c = require("c"); // really big libary, // which is only needed in this rar case // ... }); }); }, "b": function /* content of b.js */ // here is no "c": !! // which saves bandwidth
// may be named "a.output.js": webmake_magic_jsonp_function( // the jsonp callback function "a", // origin of code loading (used for identifing the stored function) { "c": function(/* ... */, process) { // the content of the big libary }, "d": function(/* ... */, process) { // d.js is here a dependency of c.js (optional) } }
This feature may makes the compile process a big complexer.
It may be useful for:
IslaMurtazaev, qianxuemin, piyush1104, akgupta0777, AbdallahHemdan and 7 morebigbossx and rendaardysapegin, Haroenv, chee, dhruvdutt, daniel-234 and 30 moreTUARAN, myshov, ikobe-zz, zxch3n, akgupta0777 and 4 moreakgupta0777, artmsv and kothariji
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4