Skip to content

Commit e72a16f

Browse files
committed
Added public urlArgs method (as suggested in #66)
urlArgs makes it possible to concat a querystring to all scripts, e.g. for cache busting purposes.
1 parent d0186e3 commit e72a16f

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/script.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
, delay = {}
1616
, scripts = {}
1717
, scriptpath
18+
, urlArgs
1819

1920
function every(ar, fn) {
2021
for (var i = 0, j = ar.length; i < j; ++i) if (!fn(ar[i])) return f
@@ -73,7 +74,7 @@
7374
fn()
7475
}
7576
el.async = 1
76-
el.src = path
77+
el.src = urlArgs ? path + (path.indexOf('?') === -1 ? '?' : '&') + urlArgs : path;
7778
head.insertBefore(el, head.lastChild)
7879
}
7980

@@ -89,6 +90,9 @@
8990
$script.path = function (p) {
9091
scriptpath = p
9192
}
93+
$script.urlArgs = function (str) {
94+
urlArgs = str;
95+
}
9296
$script.ready = function (deps, ready, req) {
9397
deps = deps[push] ? deps : [deps]
9498
var missing = [];

0 commit comments

Comments
 (0)