SlideShare une entreprise Scribd logo
1  sur  23
Lithe.js and Module Development
About me

Weibo:
http://weibo.com/designsor
Github:
https://github.com/xiaojue
Twitter:
https://twitter.com/xiao_jue
Blog:
http://www.tuer.me/user/profile/designsor
Email:
fuqiang3@staff.sina.com.cn
Module Development ?
•
•
•
•
•
•

What's it?
Why use it?
Advantages.
Drawbacks.
Existing standards.
Evolutionary history.
Module in javascript.
• Reuse and abstraction.
• Include.
• Management.
•
•
•
•

Dojo,Yui (loader class).
Commonjs.
Modules/AsynchronousDefinition.
Modules/Wrappings
Code part
https://gist.github.com/xiaojue/6972631 (some loader solutions)
http://wiki.commonjs.org/wiki/Modules/1.1.1
http://wiki.commonjs.org/wiki/Modules/AsynchronousDefinition
http://wiki.commonjs.org/wiki/Modules/Wrappings
Lithe.js ?
• What's it?
• Origin.
• Version.
Lithe
• A browser-side script loader,compatible
with the de facto
standards(NodeJS/CommonJS). It's very
simple and small,only 2.7kb gzipped.
• https://github.com/xiaojue/lithe
http://wiki.commonjs.org/wiki/Implementati
ons/lithe
Origin

https://gist.github.com/xiaojue/6972903 (bad amdjs)
https://github.com/spmjs/spm/wiki/_pages (why not seajs & spm)
Versions
User Guide
•
•
•
•
•

How to run it.
Standard.
Configuration.
Debugging.
Deploy.

• Technique nodus
Code Part
<script src="lithe.js"
data-config="config.js"
data-path="http://domain.com/"
data-debug="true"
data-main="app.js">
</script>
• So easy!!
Code Part
•
•
•
•

Define
Require
Use
Config
Node api

• https://github.com/xiaojue/lithe/blob/master/README.md
Code Part
•

(function(global,undef){

•

var isBrowser = !! (typeof window !== undef && global.navigator &&
global.document);

•

var debug = isBrowser ? (/debug/).test(location.search) : null;

•

var mod = {

•

alias:{},

•

basepath: debug ? 'path/src/' : 'path/dist'
– };
– If (global.define && isBrowser) {
• define('config',function(){
• return mod;
• });
– }else{
• module.exports = mod;
– }

•

})(this);
How to deploy?
https://github.com/xiaojue/grunt-lithe (use gruntjs)
https://github.com/xiaojue/lithe/blob/master/example.js
node native)
Lithe.tool
Lithe.hfs
FindJsAllrequires
ConcatFile
UglifyJs
Walk
… ….

(use
Technique nodus
• 1.Multi-module in one file.
• 2.Circular dependencies.
• https://github.com/xiaojue/lithe/blob/master/src/module.js

• 3.Online debuging.
•

Source map? Debug config?
Future
• 1.plugns.
• 2.combine url support.
• … ...
Practice
• Sina blog for mobile version (iphone and ipad).
• Voluminous Weibo (Beta).
• Some others.
Mobile Blog

http://liangdong.sinaapp.com/share/my/mobileblog/mobileblog.html#/4
Voluminous weibo
UML
UML
http://www.slideshare.net/xiaojueqq12345/lithe
Lithe

Contenu connexe

Similaire à Lithe

Ready? Bootstrap! Go! (CFUG Belgium 24 04-2012)
Ready? Bootstrap! Go! (CFUG Belgium 24 04-2012)Ready? Bootstrap! Go! (CFUG Belgium 24 04-2012)
Ready? Bootstrap! Go! (CFUG Belgium 24 04-2012)Guust Nieuwenhuis
 
海纳百川,有容乃大
海纳百川,有容乃大海纳百川,有容乃大
海纳百川,有容乃大hujinpu
 
Intoduction to React
Intoduction to ReactIntoduction to React
Intoduction to ReactRubizza
 
Blogs 101 and Websites for Free
Blogs 101 and Websites for Free Blogs 101 and Websites for Free
Blogs 101 and Websites for Free cat509
 
Laug Mootools And Common Js
Laug   Mootools And Common JsLaug   Mootools And Common Js
Laug Mootools And Common JsSkills Matter
 
Angular JS - Introduction
Angular JS - IntroductionAngular JS - Introduction
Angular JS - IntroductionSagar Acharya
 
Up and Running Quickly with Vue.js
Up and Running Quickly with Vue.jsUp and Running Quickly with Vue.js
Up and Running Quickly with Vue.jsBurton Smith
 
Enterprise 2.0 using Social Frameworks like Agorava (SMWHH 2014)
Enterprise 2.0 using Social Frameworks like Agorava (SMWHH 2014)Enterprise 2.0 using Social Frameworks like Agorava (SMWHH 2014)
Enterprise 2.0 using Social Frameworks like Agorava (SMWHH 2014)Werner Keil
 
Untangling spring week5
Untangling spring week5Untangling spring week5
Untangling spring week5Derek Jacoby
 
淺談 Startup 公司的軟體開發流程 v2
淺談 Startup 公司的軟體開發流程 v2淺談 Startup 公司的軟體開發流程 v2
淺談 Startup 公司的軟體開發流程 v2Wen-Tien Chang
 
Agile startup company management and operation
Agile startup company management and operationAgile startup company management and operation
Agile startup company management and operationJiang Zhu
 
Angular JS, A dive to concepts
Angular JS, A dive to conceptsAngular JS, A dive to concepts
Angular JS, A dive to conceptsAbhishek Sur
 
Backbone/Marionette recap [2015]
Backbone/Marionette recap [2015]Backbone/Marionette recap [2015]
Backbone/Marionette recap [2015]Andrii Lundiak
 
Enterprise 2.0 using Social Frameworks like Agorava (SMWCPH 2014)
Enterprise 2.0 using Social Frameworks like Agorava (SMWCPH 2014)Enterprise 2.0 using Social Frameworks like Agorava (SMWCPH 2014)
Enterprise 2.0 using Social Frameworks like Agorava (SMWCPH 2014)Werner Keil
 
Introduction to Twitter's Bootstrap 2
Introduction to Twitter's Bootstrap 2Introduction to Twitter's Bootstrap 2
Introduction to Twitter's Bootstrap 2Julien Renaux
 
Adopt A JSR - MoroccoJUG
Adopt A JSR - MoroccoJUGAdopt A JSR - MoroccoJUG
Adopt A JSR - MoroccoJUGMorocco JUG
 
full stqack guktgktktykytkyyyjrneyrynye5n
full stqack guktgktktykytkyyyjrneyrynye5nfull stqack guktgktktykytkyyyjrneyrynye5n
full stqack guktgktktykytkyyyjrneyrynye5nGoogleDSCDibrugarhUn
 

Similaire à Lithe (20)

Ready? Bootstrap! Go! (CFUG Belgium 24 04-2012)
Ready? Bootstrap! Go! (CFUG Belgium 24 04-2012)Ready? Bootstrap! Go! (CFUG Belgium 24 04-2012)
Ready? Bootstrap! Go! (CFUG Belgium 24 04-2012)
 
海纳百川,有容乃大
海纳百川,有容乃大海纳百川,有容乃大
海纳百川,有容乃大
 
Intoduction to React
Intoduction to ReactIntoduction to React
Intoduction to React
 
Blogs 101 and Websites for Free
Blogs 101 and Websites for Free Blogs 101 and Websites for Free
Blogs 101 and Websites for Free
 
Laug Mootools And Common Js
Laug   Mootools And Common JsLaug   Mootools And Common Js
Laug Mootools And Common Js
 
Angular JS - Introduction
Angular JS - IntroductionAngular JS - Introduction
Angular JS - Introduction
 
Up and Running Quickly with Vue.js
Up and Running Quickly with Vue.jsUp and Running Quickly with Vue.js
Up and Running Quickly with Vue.js
 
Enterprise 2.0 using Social Frameworks like Agorava (SMWHH 2014)
Enterprise 2.0 using Social Frameworks like Agorava (SMWHH 2014)Enterprise 2.0 using Social Frameworks like Agorava (SMWHH 2014)
Enterprise 2.0 using Social Frameworks like Agorava (SMWHH 2014)
 
Protractor survival guide
Protractor survival guideProtractor survival guide
Protractor survival guide
 
Untangling spring week5
Untangling spring week5Untangling spring week5
Untangling spring week5
 
淺談 Startup 公司的軟體開發流程 v2
淺談 Startup 公司的軟體開發流程 v2淺談 Startup 公司的軟體開發流程 v2
淺談 Startup 公司的軟體開發流程 v2
 
Agile startup company management and operation
Agile startup company management and operationAgile startup company management and operation
Agile startup company management and operation
 
Angular JS, A dive to concepts
Angular JS, A dive to conceptsAngular JS, A dive to concepts
Angular JS, A dive to concepts
 
Backbone/Marionette recap [2015]
Backbone/Marionette recap [2015]Backbone/Marionette recap [2015]
Backbone/Marionette recap [2015]
 
Backbone 4.0
Backbone 4.0Backbone 4.0
Backbone 4.0
 
Enterprise 2.0 using Social Frameworks like Agorava (SMWCPH 2014)
Enterprise 2.0 using Social Frameworks like Agorava (SMWCPH 2014)Enterprise 2.0 using Social Frameworks like Agorava (SMWCPH 2014)
Enterprise 2.0 using Social Frameworks like Agorava (SMWCPH 2014)
 
Introduction to Twitter's Bootstrap 2
Introduction to Twitter's Bootstrap 2Introduction to Twitter's Bootstrap 2
Introduction to Twitter's Bootstrap 2
 
Adopt A JSR - MoroccoJUG
Adopt A JSR - MoroccoJUGAdopt A JSR - MoroccoJUG
Adopt A JSR - MoroccoJUG
 
full stqack guktgktktykytkyyyjrneyrynye5n
full stqack guktgktktykytkyyyjrneyrynye5nfull stqack guktgktktykytkyyyjrneyrynye5n
full stqack guktgktktykytkyyyjrneyrynye5n
 
Java User Group Cologne
Java User Group CologneJava User Group Cologne
Java User Group Cologne
 

Plus de xiaojueqq12345

Fds-给前端用的服务器
Fds-给前端用的服务器Fds-给前端用的服务器
Fds-给前端用的服务器xiaojueqq12345
 
Web program-peformance-optimization
Web program-peformance-optimizationWeb program-peformance-optimization
Web program-peformance-optimizationxiaojueqq12345
 
淘宝帮派活动项目总结
淘宝帮派活动项目总结淘宝帮派活动项目总结
淘宝帮派活动项目总结xiaojueqq12345
 

Plus de xiaojueqq12345 (7)

前端模块化开发
前端模块化开发前端模块化开发
前端模块化开发
 
Fds-给前端用的服务器
Fds-给前端用的服务器Fds-给前端用的服务器
Fds-给前端用的服务器
 
Voluminous_Weibo
Voluminous_WeiboVoluminous_Weibo
Voluminous_Weibo
 
nodejs开发web站点
nodejs开发web站点nodejs开发web站点
nodejs开发web站点
 
Web program-peformance-optimization
Web program-peformance-optimizationWeb program-peformance-optimization
Web program-peformance-optimization
 
Mxhr
MxhrMxhr
Mxhr
 
淘宝帮派活动项目总结
淘宝帮派活动项目总结淘宝帮派活动项目总结
淘宝帮派活动项目总结
 

Dernier

EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 

Dernier (20)

EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 

Lithe

Notes de l'éditeur

  1. {}