Clarified that setup and teardown methods are async.
h3rald h3rald@h3rald.com
Sat, 23 May 2020 23:04:28 +0200
2 files changed,
5 insertions(+),
3 deletions(-)
M
docs/H3_DeveloperGuide.htm
→
docs/H3_DeveloperGuide.htm
@@ -7515,11 +7515,12 @@ <li>may have built-in local state, initialized during setup and (typically) destroyed during teardown.</li>
</ul> -<p>Route components are stll created using ordinary function returning a VNode, but you can optionally define a <strong>setup</strong> and a <strong>teardown</strong> method on them (Functions are Objects in JavaScript after all…) to be executed during the corresponding phase.</p> +<p>Route components are stll created using ordinary function returning a VNode, but you can optionally define a <strong>setup</strong> and a <strong>teardown</strong> async methods on them (Functions are Objects in JavaScript after all…) to be executed during the corresponding phase.</p> <p>Note that: * Both the <strong>setup</strong> method take an object as a parameter, representing the component state. Such object will be empty the first time the <strong>setup</strong> method is called for a given component, but it may contain properties not removed during teardowns. -* The <strong>teardown</strong> method can return an object, which will be retained as component state. If however nothing is returned, the component state is deleted.</p> +* The <strong>teardown</strong> method can return an object, which will be retained as component state. If however nothing is returned, the component state is deleted. +* Both methods can be asynchronous, in which case H3 will wait for their completion before proceeding.</p> <a name="How-everything-works..."></a> <h3>How everything works…<a href="#document-top" title="Go to top"></a></h3>
M
docs/md/key-concepts.md
→
docs/md/key-concepts.md
@@ -85,11 +85,12 @@
* may have a dedicated *setup* (after the route component is added to the DOM) and *teardown* phase (after the route component is removed from the DOM and the new route component is loaded). * may have built-in local state, initialized during setup and (typically) destroyed during teardown. -Route components are stll created using ordinary function returning a VNode, but you can optionally define a **setup** and a **teardown** method on them (Functions are Objects in JavaScript after all...) to be executed during the corresponding phase. +Route components are stll created using ordinary function returning a VNode, but you can optionally define a **setup** and a **teardown** async methods on them (Functions are Objects in JavaScript after all...) to be executed during the corresponding phase. Note that: * Both the **setup** method take an object as a parameter, representing the component state. Such object will be empty the first time the **setup** method is called for a given component, but it may contain properties not removed during teardowns. * The **teardown** method can return an object, which will be retained as component state. If however nothing is returned, the component state is deleted. +* Both methods can be asynchronous, in which case H3 will wait for their completion before proceeding. ### How everything works...