Skip to content

Commit

Permalink
Modified keyed update on ToC docs (#2296)
Browse files Browse the repository at this point in the history
Co-authored-by: endigo9740 <[email protected]>
  • Loading branch information
phamduylong and endigo9740 authored Dec 18, 2023
1 parent 746af38 commit 9e8fc22
Showing 1 changed file with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,24 @@
<!-- Keyed Updates -->
<h3 class="h3">Keyed Updates</h3>
<p>
In some situations, you may want to force the crawler action to update on demand. Use the <code class="code">key</code> parameter
and pass a value that will be modified. This operates similar to Svelte's
<a class="anchor" href="https://svelte.dev/tutorial/key-blocks" target="_blank">key blocks</a>.
In some situations you may want to force the crawler action to update on demand. Use the <code class="code">key</code> parameter and
pass a value that will be modified, which operates similar to Svelte's
<a class="anchor" href="https://svelte.dev/tutorial/key-blocks" target="_blank">key blocks</a>. This can be useful for scanning for
new page headers for tabbed content.
</p>
<CodeBlock language="ts" code={`const tabIndex = 0;`} />
<CodeBlock language="html" code={`<div use:tocCrawler={{ key: tabIndex }}>`} />
<CodeBlock
language="ts"
code={`
let tabIndex = 0;\n
// Modifying this value triggers the crawler to run again:
// tabindex = 1;
`}
/>
<CodeBlock
language="html"
code={`<div use:tocCrawler={{ key: tabIndex }}>
`}
/>
<!-- Active on Scroll -->
<h3 class="h3">Active on Scroll</h3>
<p>
Expand Down

0 comments on commit 9e8fc22

Please sign in to comment.