diff options
| author | 2021-02-03 19:17:50 -0500 | |
|---|---|---|
| committer | 2021-02-03 19:17:50 -0500 | |
| commit | 475d074fd74425efbe783fad08f97f2df0c4909f (patch) | |
| tree | 2acdae53999b3c74b716efa4edb5b40311fa356a /npm_assets/node_modules/livereload-js/lib/options.js | |
| parent | cd502d52787f666fff3254d7d7e7578930c813c2 (diff) | |
| parent | 3a0d66f07b112b6d2bdc2b57bbf717a89a351ce6 (diff) | |
Update upstream source from tag 'upstream/8.1.2'
Update to upstream version '8.1.2'
with Debian dir e5e966a9e6010ef70618dc9a61558fa4db35aceb
Diffstat (limited to 'npm_assets/node_modules/livereload-js/lib/options.js')
| -rw-r--r-- | npm_assets/node_modules/livereload-js/lib/options.js | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/npm_assets/node_modules/livereload-js/lib/options.js b/npm_assets/node_modules/livereload-js/lib/options.js new file mode 100644 index 0000000..72475ed --- /dev/null +++ b/npm_assets/node_modules/livereload-js/lib/options.js @@ -0,0 +1,60 @@ +(function() { + var Options; + + exports.Options = Options = (function() { + function Options() { + this.https = false; + this.host = null; + this.port = 35729; + this.snipver = null; + this.ext = null; + this.extver = null; + this.mindelay = 1000; + this.maxdelay = 60000; + this.handshake_timeout = 5000; + } + + Options.prototype.set = function(name, value) { + if (typeof value === 'undefined') { + return; + } + if (!isNaN(+value)) { + value = +value; + } + return this[name] = value; + }; + + return Options; + + })(); + + Options.extract = function(document) { + var element, i, j, keyAndValue, len, len1, m, mm, options, pair, ref, ref1, src; + ref = document.getElementsByTagName('script'); + for (i = 0, len = ref.length; i < len; i++) { + element = ref[i]; + if ((src = element.src) && (m = src.match(/^[^:]+:\/\/(.*)\/z?livereload\.js(?:\?(.*))?$/))) { + options = new Options(); + options.https = src.indexOf("https") === 0; + if (mm = m[1].match(/^([^\/:]+)(?::(\d+))?(\/+.*)?$/)) { + options.host = mm[1]; + if (mm[2]) { + options.port = parseInt(mm[2], 10); + } + } + if (m[2]) { + ref1 = m[2].split('&'); + for (j = 0, len1 = ref1.length; j < len1; j++) { + pair = ref1[j]; + if ((keyAndValue = pair.split('=')).length > 1) { + options.set(keyAndValue[0].replace(/-/g, '_'), keyAndValue.slice(1).join('=')); + } + } + } + return options; + } + } + return null; + }; + +}).call(this); |
