Skip to content

Less than 2kb global helper function called _async, which loads external scripts asynchronously with callbacks.

Notifications You must be signed in to change notification settings

tacsoln/javascript-async-callback

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JavaScript Async Callback 0.0.1

Less than 2kb global helper function called _async, which loads external scripts asynchronously with callbacks.

Works across all browsers, see Compatibility.

Live Demo

View the live demo.

Quick Start

Add the script to the <head> of your document (or before all other scripts using _async):

<script src="//raw.github.com/niftylettuce/javascript-async-callback/master/async.min.js"></script>

Then asynchronously load a script with a callback function:

(function liveDemo() {
  var src = '//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js'
  function callback() {
    alert('It works!')
  }
  _async.load(document, src, callback)
}())

... and you're done!

Compatibility

IE FF Chrome Safari Opera iOS Opera Mini Android Blackberry Opera Mobile Chrome Android Firefox Android
5.5+ ✓ 2.0+ ✓ 4.0+ ✓ 3.1+ ✓ 9.0+ ✓ 3.2+ ✓ 5.0+ ✓ 2.1+ ✓ 7.0+ ✓ 10.0+ ✓ 18.0+ ✓ 15.0+ ✓

Contributors

License

MIT Licensed

About

Less than 2kb global helper function called _async, which loads external scripts asynchronously with callbacks.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published