Closed ElliotPenson closed 5 years ago
Create a utility that adds a listener to the beforeunload event. This will cause a message to be shown to the user before they reload or exit the site.
beforeunload
window.addEventListener('beforeunload', event => { event.preventDefault(); event.returnValue = ''; });
Call this utility in the componentDidMount method of Create. Remove the listener when the user publishes the fractal.
componentDidMount
Create
Create a utility that adds a listener to the
beforeunload
event. This will cause a message to be shown to the user before they reload or exit the site.Call this utility in the
componentDidMount
method ofCreate
. Remove the listener when the user publishes the fractal.