0.2.5 • Published 2 years ago

jsi v0.2.5

Weekly downloads
318
License
-
Repository
github
Last release
2 years ago

:q #JSI Introduction a simple module loader , you can use npm installed modules in web browser such as it work in nodejs!

Install:

npm install jsi -g

Start:

  • install and run example:

    		$ cd <webroot>
    		$ jsi example
    		$ open http://localhost:8080
    	
  • command line * on webroot

    			$ jsi example 									--deplay hello world example
    			$ jsi start										--start debug server
    
    	* on [webroot]/[scriptroot]
    
    			$ jsi export -o temp.js main.js					--export main.js as a single javascript file
    																(main.js variables on global namespace;
    																	buf dependence modules is hidden, you can use require('modulename') to get it )
    			$ jsi export -o exported.js -ns xmldom xmldom	--export package: export xmldom to a single script and exports variables on the namespace xmldom.
		//advance useage:  install a optimized external package on package system.

$ jsi install jquery --install a exter:qnal optimized package from npm $ jsi install ./workspace/xmldom --install a external optimized package from local filesystem

  • lite template example

    		//function template
    		var tpl = function(list){
    			return <div>
    				<c:if test='${var1>var2}'>test${value}</c:if>
    				<p> this is a xml style templete ${varName}; 
    				default syntax support for mostly javascript editor (E4X standard) </p>
    			</div>
    		}
    		//inline template render
    		var tpl = <div>
    			<p> this is a xml style templete ; 
    				default syntax support for mostly javascript editor (E4X standard) </p>
    		</div>
    	
    		//single template file
    		var tpl = liteXML("/path.tpl")
    
    		//partly template file(css3 selector)
    		var tpl = liteXML("/path.tpl#header")
    	
  • javascript debug and compress

    	* enable debug
    
    		javascript:document.cookie="JSI_DEBUG=true"
    	* disable debug	
    
    		javascript:document.cookie="JSI_DEBUG=false"
  • test route /route.js

    		content:
    		exports = [
    
    			//mock with json data
    			{path:"/service/login.do",data:{"auth-token":"sdeee23734ru3hfbvncm"}},
    
    			//mock from remote url 
    			{path:"/service/user.do",remote:"http://test.com/user.do"},
    
    			//mock from local json file
    			{path:"/service/user.do",file:"./mock/user.json"},
		//mock with nodejs request handle
		{
			path:	/\/service\/user\/(\d+)/,
			action:	function(request,response,path,uid){
				var headers = {"Content-Type":"text/json;charset=utf-8"};
				response.writeHead(200, headers); 
				response.end(JSON.stringify({"uid":uid}));
				return true;
			}
		}
	]
0.2.5

2 years ago

0.2.4

3 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.42

7 years ago

0.1.41

7 years ago

0.1.39

7 years ago

0.1.37

7 years ago

0.1.36

7 years ago

0.1.35

7 years ago

0.1.34

7 years ago

0.1.33

7 years ago

0.1.32

9 years ago

0.1.31

9 years ago

0.1.30

9 years ago

0.1.29

9 years ago

0.1.28

9 years ago

0.1.26

9 years ago

0.1.25

9 years ago

0.1.24

9 years ago

0.1.23

9 years ago

0.1.22

9 years ago

0.1.21

9 years ago

0.1.20

9 years ago

0.1.19

9 years ago

0.1.18

9 years ago

0.1.17

9 years ago

0.1.16

9 years ago

0.1.15

9 years ago

0.1.14

9 years ago

0.1.13

9 years ago

0.1.12

10 years ago

0.1.11

10 years ago

0.1.10

10 years ago

0.1.9

12 years ago

0.1.8

12 years ago

0.1.7

12 years ago

0.1.6

12 years ago

0.1.5

12 years ago

0.1.4

12 years ago

0.1.3

12 years ago

0.1.2

12 years ago

0.1.1

12 years ago

0.1.0

12 years ago