Skip to content

Commit

Permalink
Merge pull request RickoNoNo3#31 from acdavit/main
Browse files Browse the repository at this point in the history
Better readability
  • Loading branch information
RickoNoNo3 authored Jun 18, 2023
2 parents aa36668 + 2ea4611 commit 63fd9c3
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,11 @@ const [windows, setWindows] = useState([]);
const handleClose = (force, id) => {
let state = [...windows];
const index = state.findIndex(info => info.id === id);
if (index !== -1) {
if (state[index].onclose && state[index].onclose(force))
return true; // window-specific onclose, returns true if it does not need the default close process.
state.splice(index, 1);
setTimeout(() => setWindows(state)); // to change winbox showing state while `onclose`, MUST wrap it within `setTimeout`
}
if (index === -1) return
if (state[index].onclose && state[index].onclose(force)) return true;
// window-specific onclose, returns true if it does not need the default close process.
state.splice(index, 1);
setTimeout(() => setWindows(state)); // to change winbox showing state while `onclose`, MUST wrap it within `setTimeout`
};

return (
Expand Down Expand Up @@ -282,4 +281,4 @@ For old versions upgrading to v1.5.x, these things deserve attention:
- **All old versions have bugs in React 18+, but v1.5+ do not.**
- CSS files need to be imported manually. See [example 1](#examples).
- All props are camel-cased, use `onClose` instead of `onclose`.
- `splitscreen` has been removed, some props and methods were added.
- `splitscreen` has been removed, some props and methods were added.

0 comments on commit 63fd9c3

Please sign in to comment.