Skip to content

Commit

Permalink
Added public urlArgs method (as suggested in #66)
Browse files Browse the repository at this point in the history
urlArgs makes it possible to concat a querystring to all scripts, e.g. for cache busting purposes.
  • Loading branch information
boye committed May 14, 2014
1 parent d0186e3 commit e72a16f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
, delay = {}
, scripts = {}
, scriptpath
, urlArgs

function every(ar, fn) {
for (var i = 0, j = ar.length; i < j; ++i) if (!fn(ar[i])) return f
Expand Down Expand Up @@ -73,7 +74,7 @@
fn()
}
el.async = 1
el.src = path
el.src = urlArgs ? path + (path.indexOf('?') === -1 ? '?' : '&') + urlArgs : path;
head.insertBefore(el, head.lastChild)
}

Expand All @@ -89,6 +90,9 @@
$script.path = function (p) {
scriptpath = p
}
$script.urlArgs = function (str) {
urlArgs = str;
}
$script.ready = function (deps, ready, req) {
deps = deps[push] ? deps : [deps]
var missing = [];
Expand Down

0 comments on commit e72a16f

Please sign in to comment.