GithubHelp home page GithubHelp logo

guoxuanming / kis-requirejs-demo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from johnpapa/kis-requirejs-demo

0.0 2.0 0.0 290 KB

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

kis-requirejs-demo's Introduction

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

kis-requirejs-demo's People

Contributors

johnpapa avatar wardbell avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.