mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 14:45:49 +01:00
refactor: attempt to refactor spacing issues detected by houndci
This commit is contained in:
parent
9d5280d4d6
commit
c2c9c331cd
2 changed files with 28 additions and 34 deletions
|
|
@ -2,34 +2,34 @@ import React, { useState } from 'react';
|
|||
import Modal from 'react-modal';
|
||||
|
||||
function HelloWorld() {
|
||||
const [showModal, setShowModal] = useState(false);
|
||||
const [result, setResult] = useState(null);
|
||||
const [showModal, setShowModal] = useState(false);
|
||||
const [result, setResult] = useState(null);
|
||||
|
||||
const handleOpenModal = () => {
|
||||
setShowModal(true);
|
||||
const handleOpenModal = () => {
|
||||
setShowModal(true);
|
||||
|
||||
window.backend.basic().then((result) => setResult(result));
|
||||
};
|
||||
window.backend.basic().then((result) => setResult(result));
|
||||
};
|
||||
|
||||
const handleCloseModal = () => {
|
||||
setShowModal(false);
|
||||
};
|
||||
const handleCloseModal = () => {
|
||||
setShowModal(false);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="App">
|
||||
<button onClick={() => handleOpenModal()} type="button">
|
||||
Hello
|
||||
return (
|
||||
<div className="App">
|
||||
<button onClick={() => handleOpenModal()} type="button">
|
||||
Hello
|
||||
</button>
|
||||
<Modal
|
||||
appElement={document.getElementById("app")}
|
||||
isOpen={showModal}
|
||||
contentLabel="Minimal Modal Example"
|
||||
>
|
||||
<p>{result}</p>
|
||||
<button onClick={() => handleCloseModal()}>Close Modal</button>
|
||||
</Modal>
|
||||
</div>
|
||||
);
|
||||
<Modal
|
||||
appElement={document.getElementById("app")}
|
||||
isOpen={showModal}
|
||||
contentLabel="Minimal Modal Example"
|
||||
>
|
||||
<p>{result}</p>
|
||||
<button onClick={() => handleCloseModal()}>Close Modal</button>
|
||||
</Modal>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default HelloWorld;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ const isLocalhost = Boolean(
|
|||
window.location.hostname === 'localhost' ||
|
||||
// [::1] is the IPv6 localhost address.
|
||||
window.location.hostname === '[::1]' ||
|
||||
// 127.0.0.0/8 are considered localhost for IPv4.
|
||||
// 127.0.0.1/8 is considered localhost for IPv4.
|
||||
window.location.hostname.match(
|
||||
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
|
||||
)
|
||||
|
|
@ -100,9 +100,7 @@ function registerValidSW(swUrl, config) {
|
|||
|
||||
function checkValidServiceWorker(swUrl, config) {
|
||||
// Check if the service worker can be found. If it can't reload the page.
|
||||
fetch(swUrl, {
|
||||
headers: { 'Service-Worker': 'script' },
|
||||
})
|
||||
fetch(swUrl)
|
||||
.then(response => {
|
||||
// Ensure service worker exists, and that we really are getting a JS file.
|
||||
const contentType = response.headers.get('content-type');
|
||||
|
|
@ -130,12 +128,8 @@ function checkValidServiceWorker(swUrl, config) {
|
|||
|
||||
export function unregister() {
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.ready
|
||||
.then(registration => {
|
||||
registration.unregister();
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(error.message);
|
||||
});
|
||||
navigator.serviceWorker.ready.then(registration => {
|
||||
registration.unregister();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue