Skip to content

Commit 3cc6311

Browse files
committed
document autosave functionality. fixes #51.
1 parent afdf467 commit 3cc6311

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

index.html

+37
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ <h2>Table of Contents</h2>
2020
<ol>
2121
<li><a href="#quick-start">Quick Start</a>
2222
<li><a href="#autoplay">Autoplay</a>
23+
<li><a href="#autosave">Autosave</a>
2324
<li><a href="#implicit-setup">Implicit <code>setup()</code></a>
2425
<li><a href="#error-handling">Error Handling</a>
2526
<li><a href="#resizing">Resizing</a>
@@ -68,6 +69,42 @@ <h2 id="autoplay">Autoplay</h2>
6869
}
6970
</script>
7071

72+
<h2 id="autosave">Autosave</h2>
73+
74+
<p>
75+
The widget automatically saves the current editor content in the
76+
current <em>page session</em>, and restores it on page load.
77+
From the <a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage">Mozilla Developer Network</a>:
78+
</p>
79+
80+
<blockquote>
81+
A page session lasts for as long as the browser is open and survives
82+
over page reloads and restores. Opening a page in a new tab or window
83+
will cause a new session to be initiated.
84+
</blockquote>
85+
86+
<p>
87+
This generally means that if a user accidentally navigates
88+
away from the page, their work won't be lost if they navigate
89+
back to it via their browser's back/forward buttons or
90+
its <a href="http://www.computerhope.com/tips/tip16.htm">undo
91+
closed tab</a> functionality.
92+
</p>
93+
94+
<p>
95+
Users always have the freedom to revert the widget's code to
96+
its initial state (i.e., the code specified by the embedding page)
97+
via the "Revert" button on the toolbar.
98+
</p>
99+
100+
<p>
101+
In some cases, the above behavior may be undesirable. If you
102+
want to be able to disable it or otherwise configure it to behave
103+
differently, please feel free to
104+
<a href="https://github.com/toolness/p5.js-widget/issues/new">file
105+
an issue</a>.
106+
</p>
107+
71108
<h2 id="implicit-setup">Implicit <code>setup()</code></h2>
72109

73110
<p>

0 commit comments

Comments
 (0)