Instead of checks like:
if (value === null) {
throw new Error("missing value")
}
doSomethingThatNeedsValue(value)
// use Prompt like normal... magic happens in getUserConfirmation | |
class App extends Component { | |
render () { | |
return ( | |
<Router getUserConfirmation={getUserConfirmation}> | |
{...} | |
<Prompt | |
when={formIsHalfFilledOut} | |
message="Are you sure you want to leave?" | |
/> |
// .filter(Boolean) | |
// .fitler to unique values | |
const fruit = ['Apple', 'Banana', 'Apple', 'Orange'] | |
console.log(Array.from(new Set(fruit))) | |
const unique = (element, index, fullArray) => fullArray.indexOf(element) === index | |
console.log(fruit.filter(unique)) | |
/* |
You may want to employ the Parcel backed boilerplate that implements the solution described below.
# Turn on Notifications | |
do shell script "defaults -currentHost write com.apple.notificationcenterui doNotDisturb -bool FALSE; defaults -currentHost delete com.apple.notificationcenterui doNotDisturbDate; osascript -e 'quit application \"NotificationCenter\" ' && killall usernoted" -- this set 'Do not disturb' to false in the pref | |
# Show Desktop | |
do shell script "defaults write com.apple.finder CreateDesktop -bool true; killall Finder" | |
# Show all windows | |
tell application "System Events" | |
set visible of (every process) to true | |
end tell |