@@ -20,6 +20,7 @@ <h2>Table of Contents</h2>
20
20
< ol >
21
21
< li > < a href ="#quick-start "> Quick Start</ a >
22
22
< li > < a href ="#autoplay "> Autoplay</ a >
23
+ < li > < a href ="#autosave "> Autosave</ a >
23
24
< li > < a href ="#implicit-setup "> Implicit < code > setup()</ code > </ a >
24
25
< li > < a href ="#error-handling "> Error Handling</ a >
25
26
< li > < a href ="#resizing "> Resizing</ a >
@@ -68,6 +69,42 @@ <h2 id="autoplay">Autoplay</h2>
68
69
}
69
70
</ script >
70
71
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
+
71
108
< h2 id ="implicit-setup "> Implicit < code > setup()</ code > </ h2 >
72
109
73
110
< p >
0 commit comments