Created
April 8, 2010 12:01
-
-
Save jhuni/360014 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/***************************************************************** | |
The file RandomCode.js on the local machine: | |
*****************************************************************/ | |
/*jsan __header__ */ | |
JSAN.require('Exporter'); | |
JSAN.require('HTTP.Request'); | |
JSAN.use('Joose', 'Class'); | |
JSAN.use('List.Utils'); | |
/*jsan __end__ */ | |
for (var i = 0, l = RandomCode.length; i < l; i++) { | |
RandomCode[i](); | |
} | |
/***************************************************************** | |
The file RandomCode.js when returned from the server: | |
*****************************************************************/ | |
// FILE /Exporter.js after being packed by the server: | |
var Exporter;Exporter=(function(){var extendByKeys,flatten,isValueInArray;extendByKeys=function(obj,props,keys){var currentKey='',i=0,l=keys.length;while(i<l){currentKey=keys[i++];obj[currentKey]=typeof obj[currentKey]!=="undefined"?obj[currentKey]:props[currentKey];}};flatten=function(list){var flattenedList=[],currentElem={},i=0,l=list.length;while(i<l){currentElem=list[i++];flattenedList=flattenedList.concat(typeof currentElem==='object'?flatten(currentElem):currentElem);} | |
return flattenedList;};isValueInArray=function(arr,value){for(var i=0,l=arr.length;i<l;i++){if(arr[i]===value){return true;}} | |
return false;};return{handleModule:function(classdef,importList){var exportList=[],EXPORT=classdef.EXPORT,EXPORT_OK=classdef.EXPORT_OK,EXPORT_TAGS=classdef.EXPORT_TAGS,i,l,request,newExportKeys;if(importList.length>0){importList=flatten(importList);for(i=0,l=importList.length;i<l;i++){request=importList[i];newExportKeys=[];if(isValueInArray(EXPORT,request)||isValueInArray(EXPORT_OK,request)){newExportKeys=[request];}else if(typeof EXPORT_TAGS[request]!=='undefined'){newExportKeys=EXPORT_TAGS[request];} | |
exportList=exportList.concat(newExportKeys);}}else{exportList=EXPORT;} | |
if(typeof exportList!=="undefined"){extendByKeys(self,classdef,exportList);}}};})();if(typeof JSAN!=="undefined"){JSAN.observers.push(function(packageName,packageValue,importList){if(importList){Exporter.handleModule(packageValue,importList);}});} | |
// FILE: /HTTP/Request.js after being packed by the server: | |
if(typeof(HTTP)=="undefined"){HTTP={};} | |
if(typeof(HTTP.Request)=="undefined"){HTTP.Request=function(options){/*...*/}} | |
// FILE: /Joose.js after being packed: | |
if(typeof(Joose)=="undefined"){Joose={/*...*/}} | |
// Don't forget importing because before it was a use statement: | |
import(Joose, 'Class'); | |
// FILE: /List/Utils.js after being packed: | |
if(typeof(List)=="undefined"){List={}} | |
if(typeof(List.Utils)=="undefined"){List.Utils={/*...*/}} | |
// Don't forget importing again: | |
import(List.Utils); | |
// Finally lets leave the remaining part of RandomCode.js packed: | |
for(var i=0,l=RandomCode.length;i<l;i++){RandomCode[i]();} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment