browser-sync-connect
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -10,3 +10,4 @@ (function(exports) { | ||
port = port || 3e3; | ||
version = version || "0.8.2"; | ||
version = version || "0.9.1"; | ||
var hasConnector = parseFloat(version) >= .9; | ||
var socketUrl = "//" + host + ":" + port; | ||
@@ -16,9 +17,14 @@ var clientUrl = "//" + host + ":" + (port + 1); | ||
script.src = socketUrl + "/socket.io/socket.io.js"; | ||
script.defer = hasConnector; | ||
script.id = id; | ||
script.onload = function() { | ||
var s = document.createElement("script"); | ||
s.innerHTML = 'var ___socket___ = io.connect("' + socketUrl + '");'; | ||
document.body.appendChild(s); | ||
var s; | ||
if (!hasConnector) { | ||
s = document.createElement("script"); | ||
s.innerHTML = 'var ___socket___ = io.connect("' + socketUrl + '");'; | ||
document.body.appendChild(s); | ||
} | ||
s = document.createElement("script"); | ||
s.src = clientUrl + "/client/browser-sync-client." + version + ".js"; | ||
s.defer = hasConnector; | ||
document.body.appendChild(s); | ||
@@ -25,0 +31,0 @@ }; |
@@ -1,1 +0,1 @@ | ||
!function(exports){"use strict";var browserSyncConnect=function(host,version,port){var id="__bs_script__";if(!document.getElementById(id)){host=host||window.location.hostname,port=port||3e3,version=version||"0.8.2";var socketUrl="//"+host+":"+port,clientUrl="//"+host+":"+(port+1),script=document.createElement("script");script.src=socketUrl+"/socket.io/socket.io.js",script.id=id,script.onload=function(){var s=document.createElement("script");s.innerHTML='var ___socket___ = io.connect("'+socketUrl+'");',document.body.appendChild(s),s=document.createElement("script"),s.src=clientUrl+"/client/browser-sync-client."+version+".js",document.body.appendChild(s)},document.body.appendChild(script)}};"undefined"!=typeof module&&module.exports?module.exports=browserSyncConnect:"function"==typeof define&&define.amd?define([],function(){return browserSyncConnect}):exports.browserSyncConnect=browserSyncConnect}(this); | ||
!function(exports){"use strict";var browserSyncConnect=function(host,version,port){var id="__bs_script__";if(!document.getElementById(id)){host=host||window.location.hostname,port=port||3e3,version=version||"0.9.1";var hasConnector=parseFloat(version)>=.9,socketUrl="//"+host+":"+port,clientUrl="//"+host+":"+(port+1),script=document.createElement("script");script.src=socketUrl+"/socket.io/socket.io.js",script.defer=hasConnector,script.id=id,script.onload=function(){var s;hasConnector||(s=document.createElement("script"),s.innerHTML='var ___socket___ = io.connect("'+socketUrl+'");',document.body.appendChild(s)),s=document.createElement("script"),s.src=clientUrl+"/client/browser-sync-client."+version+".js",s.defer=hasConnector,document.body.appendChild(s)},document.body.appendChild(script)}};"undefined"!=typeof module&&module.exports?module.exports=browserSyncConnect:"function"==typeof define&&define.amd?define([],function(){return browserSyncConnect}):exports.browserSyncConnect=browserSyncConnect}(this); |
{ | ||
"name": "browser-sync-connect", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "connect to browser sync without copying the script snippets to the html source", | ||
@@ -5,0 +5,0 @@ "main": "src/browser-sync-connect.js", |
@@ -17,2 +17,4 @@ (function(exports) { | ||
var hasConnector = parseFloat(version) >= 0.9; | ||
var socketUrl = '//' + host + ':' + port; | ||
@@ -23,2 +25,3 @@ var clientUrl = '//' + host + ':' + (port + 1); | ||
script.src = socketUrl + '/socket.io/socket.io.js'; | ||
script.defer = hasConnector; | ||
script.id = id; | ||
@@ -28,10 +31,13 @@ | ||
var s = document.createElement('script'); | ||
var s; | ||
s.innerHTML = 'var ___socket___ = io.connect("' + socketUrl + '");'; | ||
document.body.appendChild(s); | ||
if (!hasConnector) { | ||
s = document.createElement('script'); | ||
s.innerHTML = 'var ___socket___ = io.connect("' + socketUrl + '");'; | ||
document.body.appendChild(s); | ||
} | ||
s = document.createElement('script'); | ||
s.src = clientUrl + '/client/browser-sync-client.' + version + '.js'; | ||
s.defer = hasConnector; | ||
document.body.appendChild(s); | ||
@@ -38,0 +44,0 @@ }; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5421
69
16