Skip to content
This repository has been archived by the owner on Oct 21, 2022. It is now read-only.

Commit

Permalink
Merge pull request #21 from riddla/master
Browse files Browse the repository at this point in the history
Mention callback ability within the README
  • Loading branch information
scottjehl committed Nov 16, 2015
2 parents 11cb22c + 2674fae commit 99ba4d8
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,23 @@ Then call it by passing it a JavaScript URL:
</head>
```

You can execute code after the Script has loaded via a callback:

``` html
<head>
...
<script>
// include loadJS here...
function loadJS( src ){ ... }
// load a file with loadJS
loadJS( "path/to/script.js", function() {
// file has loaded
});
</script>
...
</head>
```

## Why not just use `<script src="..." async defer>`?

The `async` and `defer` attributes enjoy broad browser support. They're great options when all you need to do is load a script for all users, ideally in a non-blocking manner. The limitations with these attributes are:
Expand Down

0 comments on commit 99ba4d8

Please sign in to comment.