Skip to content

Commit

Permalink
Deployed aae6229 to 0.3 with MkDocs 1.6.0 and mike 1.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
fusiondoc committed May 15, 2024
1 parent 25f0566 commit 82a0b49
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 156 deletions.
31 changes: 13 additions & 18 deletions 0.3/api-reference/general/errors/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3450,26 +3450,21 @@ <h2 id="cleanupwasrenamed">cleanupWasRenamed<a class="headerlink" href="#cleanup
<hr />
<div class="fusiondoc-error-api-section">
<h2 id="destroyedtwice">destroyedTwice<a class="headerlink" href="#destroyedtwice" title="Permanent link">&para;</a></h2>
<div class="highlight"><pre><span></span><code>Attempted to destroy Computed twice; ensure you&#39;re not manually calling
`:destroy()` while using scopes. See discussion #292 on GitHub for advice.
<div class="highlight"><pre><span></span><code>`doCleanup()` was given something that it is already cleaning up. Unclear how to
proceed.
</code></pre></div>
<p><strong>Thrown by:</strong>
<a href="../../state/members/value"><code>Value</code></a>,
<a href="../../state/members/computed"><code>Computed</code></a>,
<a href="../../state/members/observer"><code>Observer</code></a>,
<a href="../../state/members/forkeys"><code>ForKeys</code></a>,
<a href="../../state/members/forvalues"><code>ForValues</code></a>,
<a href="../../state/members/forpairs"><code>ForPairs</code></a>,
<a href="../../animation/members/spring"><code>Spring</code></a>,
<a href="../../animation/members/tween"><code>Tween</code></a></p>
<p><strong>Related discussions:</strong>
<a href="https://github.com/dphfox/Fusion/discussions/292"><code>#292</code></a></p>
<p>The <code>:destroy()</code> method of the object in question was called more than once.</p>
<p>This usually means you called <code>:destroy()</code> manually, which is almost never
required because Fusion's constructors always link objects to
<a href="../../../tutorials/fundamentals/scopes">scopes</a>. When that scope is passed to
<a href="../../memory/members/docleanup"><code>doCleanup()</code></a>, the <code>:destroy()</code> method is
called on every object inside.</p>
<a href="../../memory/members/doCleanup"><code>doCleanup</code></a></p>
<p>You called <code>doCleanup()</code> on a function or object which carried some code. When
that code was run, it attempted to call <code>doCleanup()</code> on the same thing you
called with.</p>
<p>Usually, this would result in an infinite loop, because the same code would try
to clean itself up over and over again. Because cleanup tasks are only meant to
run once, this is invalid behaviour and so this error is thrown instead.</p>
<p>Ensure your code is the rightful owner of scopes that it is trying to clean up.
In particular, avoid cleaning up scopes you receive from elsewhere, unless you
and the original provider of the scope agree to transfer the responsibility of
cleaning up the scope.</p>
</div>
<hr />
<div class="fusiondoc-error-api-section">
Expand Down
68 changes: 19 additions & 49 deletions 0.3/api-reference/memory/types/scopedobject/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1728,22 +1728,9 @@

</li>

</ul>
</nav>

</li>

<li class="md-nav__item">
<a href="#methods" class="md-nav__link">
Methods
</a>

<nav class="md-nav" aria-label="Methods">
<ul class="md-nav__list">

<li class="md-nav__item">
<a href="#destroy-" class="md-nav__link">
destroy -&gt; ()
<a href="#oldesttask-unknown" class="md-nav__link">
oldestTask : unknown
</a>

</li>
Expand Down Expand Up @@ -2884,22 +2871,9 @@

</li>

</ul>
</nav>

</li>

<li class="md-nav__item">
<a href="#methods" class="md-nav__link">
Methods
</a>

<nav class="md-nav" aria-label="Methods">
<ul class="md-nav__list">

<li class="md-nav__item">
<a href="#destroy-" class="md-nav__link">
destroy -&gt; ()
<a href="#oldesttask-unknown" class="md-nav__link">
oldestTask : unknown
</a>

</li>
Expand Down Expand Up @@ -2973,28 +2947,24 @@ <h3 id="scope-scopeunknown">
<p>The <code>scope</code> is expected to be set once upon construction. It should not be
assigned to again, except when the scope is destroyed - at which point it
should be set to <code>nil</code> to indicate that it no longer exists inside of a
scope. This is typically done inside the <code>:destroy()</code> method, if it exists.</p>
scope. This is typically done inside of <code>oldestTask</code>.</p>
</div>
<hr />
<h2 id="methods">Methods<a class="headerlink" href="#methods" title="Permanent link">&para;</a></h2>
<h3 id="destroy-">
destroy
<h3 id="oldesttask-unknown">
oldestTask
<span class="fusiondoc-api-type">
-&gt; ()
: unknown
</span>
<a class="headerlink" href="#destroy-" title="Permanent link">&para;</a></h3>
<div class="highlight"><pre><span></span><code><span class="kr">function</span> <span class="nc">ScopedObject</span><span class="p">:</span><span class="nf">destroy</span><span class="p">():</span> <span class="p">()</span>
</code></pre></div>
<p>Called by <code>doCleanup</code> to destroy this object. User code should generally not
call this; instead, destroy the scope as a whole.</p>
<div class="admonition tip">
<p class="admonition-title">Double-destruction prevention</p>
<p>Fusion's objects throw
<a href="../../../general/errors/#destroyedtwice"><code>destroyedTwice</code></a> if they detect
a <code>nil</code> scope during<code>:destroy()</code>.</p>
<p>It's strongly recommended that you emulate this behaviour if you're
implementing your own objects, as this protects against double-destruction
and exposes potential scoping issues further ahead of time.</p>
<a class="headerlink" href="#oldesttask-unknown" title="Permanent link">&para;</a></h3>
<p>The value inside of <code>scope</code> representing the point at which the scoped object
will be destroyed.</p>
<div class="admonition note">
<p class="admonition-title">Unchanged until destruction</p>
<p>The <code>oldestTask</code> is expected to be set once upon construction. It should not
be assigned to again.</p>
<p><code>oldestTask</code> is typically a callback that cleans up the object, but it's
typed ambiguously here as it is only used as a reference for lifetime
analysis, representing the point beyond which the object can be considered
completely destroyed. It shouldn't be used for much else.</p>
</div>
<hr />
<h2 id="learn-more">Learn More<a class="headerlink" href="#learn-more" title="Permanent link">&para;</a></h2>
Expand Down
2 changes: 1 addition & 1 deletion 0.3/search/search_index.json

Large diffs are not rendered by default.

Loading

0 comments on commit 82a0b49

Please sign in to comment.