SlideShare a Scribd company logo
1 of 18
Require JS
Everything and Anything I.T.
Nirbhay K
Why Require Required
Problem
Script Tag Vomit
Solution
AMD
The Problem
Web sites are turning into Webapps.
Code complexity grows as the webapp gets bigger.
Organizing code gets harder
Developer wants cohesive/abstract javascript modules
<script src="../js/JQuery.js" type="text/javascript"></script>
<script src="../js/SwfObject.js" type="text/javascript"></script>
<script src="../js/JsLib.js" type="text/javascript"></script>
<script src="../js/Utils.js" type="text/javascript"></script>
<script src="../js/Validation.js" type="text/javascript"></script>
<script src="../js/Personal.js" type="text/javascript"></script>
<script src="../js/SpecialFeatures.js" type="text/javascript"></Script>
<script src="../js/Basket.js" type="text/javascript"></script>
<script src="../js/Catalog.js" type="text/javascript"></script>
<script src="../js/Marketing.js" type="text/javascript"></script>
<script src="../js/Search.js" type="text/javascript"></script>
<script src="../js/GlobalSpecialUIInit.js" type="text/javascript"></script>
<script src="../js/BbyMenus.js" type="text/javascript"></script>
<script src="../js/BbyMenuHover.js" type="text/javascript"></Script>
<script src="../js/BbyMenuiframe.js" type="text/javascript"></Script>
<script src="/js/CartObject.js" type="text/javascript"></script>
<script src="../js/jQueryUI.js" type="text/javascript"></script>
<script src="../Projects/_Content/Headlines/Include/HomeAccordion.js" type="te
<script src="/Projects/_Content/Include/CategoryPage/CategoryUI.js" type="text
<script src="/js/MenuAdapter.js" type="text/javascript"></script>
<script src="/Projects/Foresee/foresee-trigger.js" type="text/javascript"></script>
Script tag vomit
Script tag vomit
Slow
Many HTTP Requests
Blocking render
Manual Dependencies Management
Solution
Developer needs solutions for
Some sort or import package when writing cohesive js.
Ability to load nested dependencies asynchronously
AMD
Asynchronous Module Definition
AMD attempts to address the following problems
Ability to load nested dependencies asynchronusly
AMD is a specification, not a technology
AMD is a base specification for number of script loader
libraries.
Require JS
What is Require JS ?
When to use it?
What it does?
What is Require Js?
RequireJS implements AMD to solve the problems.
Dynamic module loading library for Javascript.
Some sort of import
Ease of use
When to use it?
When you need to load multiple Javascript files into an
application
When you need to resolved interdependent asynchronous
java script loading problem.
You can use ReqireJS for Asynchronous Script Loading and
JavaScript Dependency Management
What it Does?
Allows javascripts and its dependent file to load peacefully
before you event want to use the loaded variables/classes.
Uses a modular approach to write javascript and dependency
definitions.
Avoid polluting the global namespace
RequireJS
require()
Simplest use-case , load a singe JS file
reqire([‘scripts/helloworld.js’],function() {
//Do something after your js is loaded
});
RequireJS
require()
<script data-main="js/main"
src=”libs/require.js"></script>
Initialization..........
Require JS
Module pattern define()
//awesomemath.js
define(function(){
var sum= function (a,b) {
return a+b;
};
return {
sum:sum
}
});
Require JS
module usage
reqire([‘scripts/awesomemath.js’],function(amath) {
amath.sum(10,20);
});
Require JS
DEMO
PLUGINS
Require JS
Q&A

More Related Content

What's hot

AngularJS - Architecture decisions in a large project 
AngularJS - Architecture decisionsin a large project AngularJS - Architecture decisionsin a large project 
AngularJS - Architecture decisions in a large project Elad Hirsch
 
Asynchronous Module Definition (AMD) used for Dependency Injection (DI) and MVVM
Asynchronous Module Definition (AMD) used for Dependency Injection (DI) and MVVMAsynchronous Module Definition (AMD) used for Dependency Injection (DI) and MVVM
Asynchronous Module Definition (AMD) used for Dependency Injection (DI) and MVVMHugh Anderson
 
AngularJS with RequireJS
AngularJS with RequireJSAngularJS with RequireJS
AngularJS with RequireJSJohannes Weber
 
Packing it all: JavaScript module bundling from 2000 to now
Packing it all: JavaScript module bundling from 2000 to nowPacking it all: JavaScript module bundling from 2000 to now
Packing it all: JavaScript module bundling from 2000 to nowDerek Willian Stavis
 
Building single page applications
Building single page applicationsBuilding single page applications
Building single page applicationsSC5.io
 
Angularjs - lazy loading techniques
Angularjs - lazy loading techniques Angularjs - lazy loading techniques
Angularjs - lazy loading techniques Nir Kaufman
 
Integrating Browserify with Sprockets
Integrating Browserify with SprocketsIntegrating Browserify with Sprockets
Integrating Browserify with SprocketsSpike Brehm
 
Frontend Application Architecture, Patterns, and Workflows
Frontend Application Architecture, Patterns, and WorkflowsFrontend Application Architecture, Patterns, and Workflows
Frontend Application Architecture, Patterns, and WorkflowsTreasure Data, Inc.
 
Building Isomorphic Apps (JSConf.Asia 2014)
Building Isomorphic Apps (JSConf.Asia 2014)Building Isomorphic Apps (JSConf.Asia 2014)
Building Isomorphic Apps (JSConf.Asia 2014)Spike Brehm
 
Javascript ui for rest services
Javascript ui for rest servicesJavascript ui for rest services
Javascript ui for rest servicesIoan Eugen Stan
 
Modern Web Application Development Workflow - EclipseCon Europe 2014
Modern Web Application Development Workflow - EclipseCon Europe 2014Modern Web Application Development Workflow - EclipseCon Europe 2014
Modern Web Application Development Workflow - EclipseCon Europe 2014Stéphane Bégaudeau
 
JavaScript Dependencies, Modules & Browserify
JavaScript Dependencies, Modules & BrowserifyJavaScript Dependencies, Modules & Browserify
JavaScript Dependencies, Modules & BrowserifyJohan Nilsson
 
AngularJS Introduction
AngularJS IntroductionAngularJS Introduction
AngularJS IntroductionCarlos Morales
 
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...tdc-globalcode
 
Packing for the Web with Webpack
Packing for the Web with WebpackPacking for the Web with Webpack
Packing for the Web with WebpackThiago Temple
 
AngularJS application architecture
AngularJS application architectureAngularJS application architecture
AngularJS application architectureGabriele Falace
 

What's hot (20)

AngularJS - Architecture decisions in a large project 
AngularJS - Architecture decisionsin a large project AngularJS - Architecture decisionsin a large project 
AngularJS - Architecture decisions in a large project 
 
Asynchronous Module Definition (AMD) used for Dependency Injection (DI) and MVVM
Asynchronous Module Definition (AMD) used for Dependency Injection (DI) and MVVMAsynchronous Module Definition (AMD) used for Dependency Injection (DI) and MVVM
Asynchronous Module Definition (AMD) used for Dependency Injection (DI) and MVVM
 
AngularJS with RequireJS
AngularJS with RequireJSAngularJS with RequireJS
AngularJS with RequireJS
 
Packing it all: JavaScript module bundling from 2000 to now
Packing it all: JavaScript module bundling from 2000 to nowPacking it all: JavaScript module bundling from 2000 to now
Packing it all: JavaScript module bundling from 2000 to now
 
Building single page applications
Building single page applicationsBuilding single page applications
Building single page applications
 
Angularjs - lazy loading techniques
Angularjs - lazy loading techniques Angularjs - lazy loading techniques
Angularjs - lazy loading techniques
 
CQ5 and Sling overview
CQ5 and Sling overviewCQ5 and Sling overview
CQ5 and Sling overview
 
Integrating Browserify with Sprockets
Integrating Browserify with SprocketsIntegrating Browserify with Sprockets
Integrating Browserify with Sprockets
 
Frontend Application Architecture, Patterns, and Workflows
Frontend Application Architecture, Patterns, and WorkflowsFrontend Application Architecture, Patterns, and Workflows
Frontend Application Architecture, Patterns, and Workflows
 
Webpack
Webpack Webpack
Webpack
 
Building Isomorphic Apps (JSConf.Asia 2014)
Building Isomorphic Apps (JSConf.Asia 2014)Building Isomorphic Apps (JSConf.Asia 2014)
Building Isomorphic Apps (JSConf.Asia 2014)
 
Javascript ui for rest services
Javascript ui for rest servicesJavascript ui for rest services
Javascript ui for rest services
 
Modern Web Application Development Workflow - EclipseCon Europe 2014
Modern Web Application Development Workflow - EclipseCon Europe 2014Modern Web Application Development Workflow - EclipseCon Europe 2014
Modern Web Application Development Workflow - EclipseCon Europe 2014
 
Intro to Sails.js
Intro to Sails.jsIntro to Sails.js
Intro to Sails.js
 
JavaScript Dependencies, Modules & Browserify
JavaScript Dependencies, Modules & BrowserifyJavaScript Dependencies, Modules & Browserify
JavaScript Dependencies, Modules & Browserify
 
AngularJS Introduction
AngularJS IntroductionAngularJS Introduction
AngularJS Introduction
 
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
 
Packing for the Web with Webpack
Packing for the Web with WebpackPacking for the Web with Webpack
Packing for the Web with Webpack
 
AngularJS application architecture
AngularJS application architectureAngularJS application architecture
AngularJS application architecture
 
Kickstart sencha extjs
Kickstart sencha extjsKickstart sencha extjs
Kickstart sencha extjs
 

Similar to Require js

Webpack packing it all
Webpack packing it allWebpack packing it all
Webpack packing it allCriciúma Dev
 
All you need to know about JavaScript loading and execution in the browser - ...
All you need to know about JavaScript loading and execution in the browser - ...All you need to know about JavaScript loading and execution in the browser - ...
All you need to know about JavaScript loading and execution in the browser - ...Caelum
 
jDays2015 - JavaEE vs. Spring Smackdown
jDays2015 - JavaEE vs. Spring SmackdownjDays2015 - JavaEE vs. Spring Smackdown
jDays2015 - JavaEE vs. Spring SmackdownMert Çalışkan
 
Javascript Bundling and modularization
Javascript Bundling and modularizationJavascript Bundling and modularization
Javascript Bundling and modularizationstbaechler
 
JavaScript For People Who Don't Code
JavaScript For People Who Don't CodeJavaScript For People Who Don't Code
JavaScript For People Who Don't CodeChristopher Schmitt
 
Apache Roller, Acegi Security and Single Sign-on
Apache Roller, Acegi Security and Single Sign-onApache Roller, Acegi Security and Single Sign-on
Apache Roller, Acegi Security and Single Sign-onMatt Raible
 
Integrating React.js Into a PHP Application
Integrating React.js Into a PHP ApplicationIntegrating React.js Into a PHP Application
Integrating React.js Into a PHP ApplicationAndrew Rota
 
React basic by Yoav Amit, Wix
React basic by Yoav Amit, Wix React basic by Yoav Amit, Wix
React basic by Yoav Amit, Wix Chen Lerner
 
Aspnet 4 new features
Aspnet 4 new featuresAspnet 4 new features
Aspnet 4 new featuresErkan BALABAN
 
JavaScript front end performance optimizations
JavaScript front end performance optimizationsJavaScript front end performance optimizations
JavaScript front end performance optimizationsChris Love
 
Plone Interactivity
Plone InteractivityPlone Interactivity
Plone InteractivityEric Steele
 

Similar to Require js (20)

Webpack packing it all
Webpack packing it allWebpack packing it all
Webpack packing it all
 
All you need to know about JavaScript loading and execution in the browser - ...
All you need to know about JavaScript loading and execution in the browser - ...All you need to know about JavaScript loading and execution in the browser - ...
All you need to know about JavaScript loading and execution in the browser - ...
 
jDays2015 - JavaEE vs. Spring Smackdown
jDays2015 - JavaEE vs. Spring SmackdownjDays2015 - JavaEE vs. Spring Smackdown
jDays2015 - JavaEE vs. Spring Smackdown
 
Javascript Bundling and modularization
Javascript Bundling and modularizationJavascript Bundling and modularization
Javascript Bundling and modularization
 
Javascript
JavascriptJavascript
Javascript
 
Biwug
BiwugBiwug
Biwug
 
Coding the UI
Coding the UICoding the UI
Coding the UI
 
Coding Ui
Coding UiCoding Ui
Coding Ui
 
JavaScript For People Who Don't Code
JavaScript For People Who Don't CodeJavaScript For People Who Don't Code
JavaScript For People Who Don't Code
 
Apache Roller, Acegi Security and Single Sign-on
Apache Roller, Acegi Security and Single Sign-onApache Roller, Acegi Security and Single Sign-on
Apache Roller, Acegi Security and Single Sign-on
 
Wt unit 2 ppts client sied technology
Wt unit 2 ppts client sied technologyWt unit 2 ppts client sied technology
Wt unit 2 ppts client sied technology
 
Wt unit 2 ppts client side technology
Wt unit 2 ppts client side technologyWt unit 2 ppts client side technology
Wt unit 2 ppts client side technology
 
Integrating React.js Into a PHP Application
Integrating React.js Into a PHP ApplicationIntegrating React.js Into a PHP Application
Integrating React.js Into a PHP Application
 
J query
J queryJ query
J query
 
JavaScript Basics with baby steps
JavaScript Basics with baby stepsJavaScript Basics with baby steps
JavaScript Basics with baby steps
 
React basic by Yoav Amit, Wix
React basic by Yoav Amit, Wix React basic by Yoav Amit, Wix
React basic by Yoav Amit, Wix
 
J query
J queryJ query
J query
 
Aspnet 4 new features
Aspnet 4 new featuresAspnet 4 new features
Aspnet 4 new features
 
JavaScript front end performance optimizations
JavaScript front end performance optimizationsJavaScript front end performance optimizations
JavaScript front end performance optimizations
 
Plone Interactivity
Plone InteractivityPlone Interactivity
Plone Interactivity
 

Recently uploaded

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
 
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
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
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
 
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
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
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
 
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
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
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
 
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
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
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
 

Recently uploaded (20)

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
 
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
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
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
 
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
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
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
 
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
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
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
 
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
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
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
 

Require js

  • 1. Require JS Everything and Anything I.T. Nirbhay K
  • 2.
  • 3. Why Require Required Problem Script Tag Vomit Solution AMD
  • 4. The Problem Web sites are turning into Webapps. Code complexity grows as the webapp gets bigger. Organizing code gets harder Developer wants cohesive/abstract javascript modules
  • 5. <script src="../js/JQuery.js" type="text/javascript"></script> <script src="../js/SwfObject.js" type="text/javascript"></script> <script src="../js/JsLib.js" type="text/javascript"></script> <script src="../js/Utils.js" type="text/javascript"></script> <script src="../js/Validation.js" type="text/javascript"></script> <script src="../js/Personal.js" type="text/javascript"></script> <script src="../js/SpecialFeatures.js" type="text/javascript"></Script> <script src="../js/Basket.js" type="text/javascript"></script> <script src="../js/Catalog.js" type="text/javascript"></script> <script src="../js/Marketing.js" type="text/javascript"></script> <script src="../js/Search.js" type="text/javascript"></script> <script src="../js/GlobalSpecialUIInit.js" type="text/javascript"></script> <script src="../js/BbyMenus.js" type="text/javascript"></script> <script src="../js/BbyMenuHover.js" type="text/javascript"></Script> <script src="../js/BbyMenuiframe.js" type="text/javascript"></Script> <script src="/js/CartObject.js" type="text/javascript"></script> <script src="../js/jQueryUI.js" type="text/javascript"></script> <script src="../Projects/_Content/Headlines/Include/HomeAccordion.js" type="te <script src="/Projects/_Content/Include/CategoryPage/CategoryUI.js" type="text <script src="/js/MenuAdapter.js" type="text/javascript"></script> <script src="/Projects/Foresee/foresee-trigger.js" type="text/javascript"></script> Script tag vomit
  • 6. Script tag vomit Slow Many HTTP Requests Blocking render Manual Dependencies Management
  • 7. Solution Developer needs solutions for Some sort or import package when writing cohesive js. Ability to load nested dependencies asynchronously
  • 8. AMD Asynchronous Module Definition AMD attempts to address the following problems Ability to load nested dependencies asynchronusly AMD is a specification, not a technology AMD is a base specification for number of script loader libraries.
  • 9. Require JS What is Require JS ? When to use it? What it does?
  • 10. What is Require Js? RequireJS implements AMD to solve the problems. Dynamic module loading library for Javascript. Some sort of import Ease of use
  • 11. When to use it? When you need to load multiple Javascript files into an application When you need to resolved interdependent asynchronous java script loading problem. You can use ReqireJS for Asynchronous Script Loading and JavaScript Dependency Management
  • 12. What it Does? Allows javascripts and its dependent file to load peacefully before you event want to use the loaded variables/classes. Uses a modular approach to write javascript and dependency definitions. Avoid polluting the global namespace
  • 13. RequireJS require() Simplest use-case , load a singe JS file reqire([‘scripts/helloworld.js’],function() { //Do something after your js is loaded });
  • 15. Require JS Module pattern define() //awesomemath.js define(function(){ var sum= function (a,b) { return a+b; }; return { sum:sum } });