Skip to content
This repository has been archived by the owner. It is now read-only.
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

kis-requirejs-demo

Keep It Simple RequireJS Demo. Shows simple demo of how to use require.js.

##Overview This demo contains 2 separate html files, each with their own scripts folder. One example demonstrates how to write the code without require.js. The other shows how to add require.js. The purpose is to explain how to use require.js for dependency resolution.

##Without RequireJS The first example (index1.html) has 3 JavaScript files using the Revealing Module Pattern (Module Pattern works fine too). The dependencies are as follows:

  • main.js depends on alerter.js
  • alerter.js depends on daataservice.js

Load order is important here, and can easily be broken.

##With RequireJS The second example (index2.html) uses require.js to load the scripts. It solves the problem and has these roles:

  • starts with a kickoff script (main.js)
  • loads therest of the scripts as they are needed (when dependencies call on them)

##With RequireJS and 3rd Party Dependencies The third example (index3.html) uses require.js to load the scripts while jquery is also introduced as a dependency.

##More Related topics: Dependency Injection (DI), Revealing Module Pattern, Module Pattern, Immediately Invoked Function Execution (IIFE), and Service Locator Pattern

About

Keep It Simple RequireJS Demo. Shows simple demo of require.js before and after

Resources

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages