Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

abhi-plugin-gatsby-preview

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

abhi-plugin-gatsby-preview - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

45

gatsby-browser.js

@@ -10,22 +10,25 @@ "use strict";

}) {
const [showReloadBar, setShowReloadBar] = React.useState(false);
const [showInProgressBar, setInProgess] = React.useState(false);
const [showStatusBar, setShowStatus] = React.useState(false);
const [message, setMessage] = React.useState("");
React.useEffect(() => {
const socket = io();
socket.on("connect", () => {
console.log("Connected to cloud runner");
console.log("Connected to Gatsby Preview");
});
socket.on("reload", data => {
socket.on("status", data => {
console.log(`Received data for reload`, data);
setInProgess(false);
setShowReloadBar(true);
setTimeout(() => {
window.location.reload();
}, 1000);
if (data && data.event) {
showStatusBar(true);
}
if (data && data.event === "SUCCESS") {
setMessage("You Gatsby Preview is reloading...");
setTimeout(() => {
window.location.reload();
}, 1000);
} else {
setMessage("You Gatsby Preview is building, the page will reload when complete...");
}
});
socket.on("building", data => {
console.log(`Received data for building`, data);
setInProgess(true);
setShowReloadBar(false);
});
return () => {

@@ -35,3 +38,3 @@ return socket.close();

});
return /*#__PURE__*/React.createElement(React.Fragment, null, showReloadBar && /*#__PURE__*/React.createElement("div", {
return /*#__PURE__*/React.createElement(React.Fragment, null, showStatusBar && /*#__PURE__*/React.createElement("div", {
style: {

@@ -46,13 +49,3 @@ position: `fixed`,

}
}, "Your Preview is reloading..."), showInProgressBar && /*#__PURE__*/React.createElement("div", {
style: {
position: `fixed`,
width: `100%`,
top: 0,
left: 0,
backgroundColor: `purple`,
color: `white`,
textAlign: `center`
}
}, "Your Preview is rebuilding..."), children);
}, message), children);
}

@@ -59,0 +52,0 @@

{
"name": "abhi-plugin-gatsby-preview",
"description": "A Gatsby plugin shows status of cloud preview",
"version": "0.0.1",
"version": "0.0.2",
"author": "Abhi Aiyer",

@@ -6,0 +6,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc