Skip to content

Commit

Permalink
Connect to Live Reload only when there's stylesheets to inject
Browse files Browse the repository at this point in the history
  • Loading branch information
Nelson Rodrigues committed Oct 13, 2023
1 parent 48c0f58 commit 8dc91b9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/SuperCSSInject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ function main () {
if (message.action == "inject") {
updateInjectedStylesheets(message.urlList);

if (!liveReloadSocket || liveReloadSocket.readyState === WebSocket.CLOSED) {
if (liveReloadConnectionAttempts < liveReloadMaxAttempts) {
console.log("[SuperCSSInject]: Attempting to connect to Live Reload server.");
listenToLiveReload();
if (message.urlList.length > 0) {
if (!liveReloadSocket || liveReloadSocket.readyState === WebSocket.CLOSED) {
if (liveReloadConnectionAttempts < liveReloadMaxAttempts) {
console.log("[SuperCSSInject]: Attempting to connect to Live Reload server.");
listenToLiveReload();
}
}
}
}
Expand Down

0 comments on commit 8dc91b9

Please sign in to comment.