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

Commit 0d96d2d

Browse files
committed
Merge pull request #9 from tkadlec/master
Adding callback capabilities to loadJS
2 parents 71f84c5 + 6e82a9c commit 0d96d2d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

loadJS.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
/*! loadJS: load a JS file asynchronously. [c]2014 @scottjehl, Filament Group, Inc. (Based on http://goo.gl/REQGQ by Paul Irish). Licensed MIT */
2-
function loadJS( src ){
2+
function loadJS( src, cb ){
33
"use strict";
44
var ref = window.document.getElementsByTagName( "script" )[ 0 ];
55
var script = window.document.createElement( "script" );
66
script.src = src;
77
ref.parentNode.insertBefore( script, ref );
8+
if (cb) {
9+
script.onload = cb;
10+
}
811
return script;
912
}

0 commit comments

Comments
 (0)