GithubHelp home page GithubHelp logo

sahwar / jcors-loader Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pablomoretti/jcors-loader

0.0 2.0 0.0 5.45 MB

Little tiny loader for javascript sources using CORS

Makefile 2.49% JavaScript 92.48% HTML 5.04%

jcors-loader's Introduction

jcors-loader (v.1.2.0)

Little tiny loader for javascript sources using CORS (only 1.2KB plane and 673 with Gzip)

Goals

  • Load javascript files asynchronously in parallel.
  • Execute javascript in order.
  • Doesn't block window.onload or DOMContentLoaded. *
  • Soport in Safari, Chrome, Firefox, Opera, IE6+. *
  • No loading indicators, the page looks done and whenever the script arrives.
  • JSLint validation.

* The script works fine in IE 6/7 but blocks onload and sources not load in parallel.

http://jcors-loader.herokuapp.com/test/

Really easy to use

  • Include inline jcors-loader.min.js.
  • Enable CORS in your server if you are loading sources from other domain (cross-domain). *
  • Tell JcorsLoader the url of the javascript resource you want to load or callback to execute.
  • Enjoy it ;)

* How enable CORS ?

Example "One source with one callback"

JcorsLoader.load(
		"http://xxxx/jquery.min.js", 
		function() {
        		$("#demo").html("jQuery Loaded");
		}
		);

Example "Multiple sources with multiple callbacks"

JcorsLoader.load(
    		"http://xxxx/jquery.min.js",
			function() {
        		$("#demo").html("jQuery Loaded");
    		},
    		"http://xxxx/jquery.cookie.js",
    		function() {  
    			$.cookie('not_existing'); 
    		}
    		);

Test

require : node.js

Build

require : java

  • make build

How do I contribute ?

That is great! Just fork the project in github. Create a topic branch, write some code and send a pull request.

jcors-loader is licensed under the Apache Licence, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html)

jcors-loader's People

Contributors

bhaslop avatar natos avatar pablomoretti avatar

Watchers

 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.