-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deployed 50c26e4 to develop with MkDocs 1.6.1 and mike 2.1.3
- Loading branch information
github-actions
committed
Sep 24, 2024
1 parent
df83ac4
commit 9b7e53d
Showing
11 changed files
with
253 additions
and
251 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -876,7 +876,7 @@ | |
<span class=n>use_channel_layer</span><span class=p>(</span><span class=n>group_name</span><span class=o>=</span><span class=s2>"my-group-name"</span><span class=p>,</span> <span class=n>receiver</span><span class=o>=</span><span class=n>receive_event</span><span class=p>)</span> | ||
|
||
<span class=k>return</span> <span class=n>html</span><span class=o>.</span><span class=n>div</span><span class=p>(</span><span class=sa>f</span><span class=s2>"Message Receiver 2: </span><span class=si>{</span><span class=n>message</span><span class=si>}</span><span class=s2>"</span><span class=p>)</span> | ||
</code></pre></div></td></tr></table></div> </div> </div> </div> </details> <details class=question> <summary>How do I signal a re-render from something that isn't a component?</summary> <p>There are occasions where you may want to signal a re-render from something that isn't a component, such as a Django model signal.</p> <p>In these cases, you can use the <code class=highlight><span class=n>use_channel_layer</span></code> hook to receive a signal within your component, and then use the <code class=highlight><span class=n>get_channel_layer</span><span class=p>()</span><span class=o>.</span><span class=n>send</span><span class=p>(</span><span class=o>...</span><span class=p>)</span></code> to send the signal.</p> <p>In the example below, the sender will send a signal every time <code class=highlight><span class=n>ExampleModel</span></code> is saved. Then, when the receiver component gets this signal, it explicitly calls <code class=highlight><span class=n>set_message</span><span class=p>(</span><span class=o>...</span><span class=p>)</span></code> to trigger a re-render.</p> <div class="tabbed-set tabbed-alternate" data-tabs=17:2><input checked=checked id=__tabbed_17_1 name=__tabbed_17 type=radio><input id=__tabbed_17_2 name=__tabbed_17 type=radio><div class=tabbed-labels><label for=__tabbed_17_1>signals.py</label><label for=__tabbed_17_2>components.py</label></div> <div class=tabbed-content> <div class=tabbed-block> <div class=highlight><table class=highlighttable><tr><td class=linenos><div class=linenodiv><pre><span></span><span class=normal> 1</span> | ||
</code></pre></div></td></tr></table></div> </div> </div> </div> </details> <details class=question> <summary>How do I signal a re-render from something that isn't a component?</summary> <p>There are occasions where you may want to signal a re-render from something that isn't a component, such as a Django model signal.</p> <p>In these cases, you can use the <code class=highlight><span class=n>use_channel_layer</span></code> hook to receive a signal within your component, and then use the <code class=highlight><span class=n>get_channel_layer</span><span class=p>()</span><span class=o>.</span><span class=n>send</span><span class=p>(</span><span class=o>...</span><span class=p>)</span></code> to send the signal.</p> <p>In the example below, the sender will signal every time <code class=highlight><span class=n>ExampleModel</span></code> is saved. Then, when the receiver gets this signal, it explicitly calls <code class=highlight><span class=n>set_message</span><span class=p>(</span><span class=o>...</span><span class=p>)</span></code> to trigger a re-render.</p> <div class="tabbed-set tabbed-alternate" data-tabs=17:2><input checked=checked id=__tabbed_17_1 name=__tabbed_17 type=radio><input id=__tabbed_17_2 name=__tabbed_17 type=radio><div class=tabbed-labels><label for=__tabbed_17_1>signals.py</label><label for=__tabbed_17_2>components.py</label></div> <div class=tabbed-content> <div class=tabbed-block> <div class=highlight><table class=highlighttable><tr><td class=linenos><div class=linenodiv><pre><span></span><span class=normal> 1</span> | ||
<span class=normal> 2</span> | ||
<span class=normal> 3</span> | ||
<span class=normal> 4</span> | ||
|
@@ -1008,7 +1008,7 @@ | |
<span class=n>origin</span> <span class=o>=</span> <span class=n>use_origin</span><span class=p>()</span> | ||
|
||
<span class=k>return</span> <span class=n>html</span><span class=o>.</span><span class=n>div</span><span class=p>(</span><span class=n>origin</span> <span class=ow>or</span> <span class=s2>"No origin"</span><span class=p>)</span> | ||
</code></pre></div></td></tr></table></div> </div> </div> </div> <details class=example> <summary>See Interface</summary> <p><font size=4><strong>Parameters</strong></font></p> <p><code class=highlight><span class=kc>None</span></code></p> <p><font size=4><strong>Returns</strong></font></p> <table> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><code class=highlight><span class=nb>str</span> <span class=o>|</span> <span class=kc>None</span></code></td> <td>A string containing the browser's current origin, obtained from WebSocket or HTTP headers (if available).</td> </tr> </tbody> </table> </details> <hr> <h3 id=use-root-id>Use Root ID<a class=headerlink href=#use-root-id title="Permanent link">¶</a></h3> <p>Shortcut that returns the root component's <code class=highlight><span class=nb>id</span></code> from the WebSocket or HTTP connection.</p> <p>The root ID is currently a randomly generated <code class=highlight><span class=n>uuid4</span></code> (unique across all root component).</p> <p>This is useful when used in combination with <a href=#use-channel-layer><code class=highlight><span class=n>use_channel_layer</span></code></a> to send messages to a specific component instance, and/or retain a backlog of messages in case that component is disconnected via <code class=highlight><span class=n>use_channel_layer</span><span class=p>(</span> <span class=o>...</span> <span class=p>,</span> <span class=n>group_discard</span><span class=o>=</span><span class=kc>False</span><span class=p>)</span></code>.</p> <div class="tabbed-set tabbed-alternate" data-tabs=22:1><input checked=checked id=__tabbed_22_1 name=__tabbed_22 type=radio><div class=tabbed-labels><label for=__tabbed_22_1>components.py</label></div> <div class=tabbed-content> <div class=tabbed-block> <div class=highlight><table class=highlighttable><tr><td class=linenos><div class=linenodiv><pre><span></span><span class=normal>1</span> | ||
</code></pre></div></td></tr></table></div> </div> </div> </div> <details class=example> <summary>See Interface</summary> <p><font size=4><strong>Parameters</strong></font></p> <p><code class=highlight><span class=kc>None</span></code></p> <p><font size=4><strong>Returns</strong></font></p> <table> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><code class=highlight><span class=nb>str</span> <span class=o>|</span> <span class=kc>None</span></code></td> <td>A string containing the browser's current origin, obtained from WebSocket or HTTP headers (if available).</td> </tr> </tbody> </table> </details> <hr> <h3 id=use-root-id>Use Root ID<a class=headerlink href=#use-root-id title="Permanent link">¶</a></h3> <p>Shortcut that returns the root component's <code class=highlight><span class=nb>id</span></code> from the WebSocket or HTTP connection.</p> <p>The root ID is a randomly generated <code class=highlight><span class=n>uuid4</span></code>. It is notable to mention that it is persistent across the current connection. The <code>uuid</code> is reset when the page is refreshed.</p> <p>This is useful when used in combination with <a href=#use-channel-layer><code class=highlight><span class=n>use_channel_layer</span></code></a> to send messages to a specific component instance, and/or retain a backlog of messages in case that component is disconnected via <code class=highlight><span class=n>use_channel_layer</span><span class=p>(</span> <span class=o>...</span> <span class=p>,</span> <span class=n>group_discard</span><span class=o>=</span><span class=kc>False</span><span class=p>)</span></code>.</p> <div class="tabbed-set tabbed-alternate" data-tabs=22:1><input checked=checked id=__tabbed_22_1 name=__tabbed_22 type=radio><div class=tabbed-labels><label for=__tabbed_22_1>components.py</label></div> <div class=tabbed-content> <div class=tabbed-block> <div class=highlight><table class=highlighttable><tr><td class=linenos><div class=linenodiv><pre><span></span><span class=normal>1</span> | ||
<span class=normal>2</span> | ||
<span class=normal>3</span> | ||
<span class=normal>4</span> | ||
|
@@ -1042,4 +1042,4 @@ | |
<span class=n>user</span> <span class=o>=</span> <span class=n>use_user</span><span class=p>()</span> | ||
|
||
<span class=k>return</span> <span class=n>html</span><span class=o>.</span><span class=n>div</span><span class=p>(</span><span class=n>user</span><span class=o>.</span><span class=n>username</span><span class=p>)</span> | ||
</code></pre></div></td></tr></table></div> </div> </div> </div> <details class=example> <summary>See Interface</summary> <p><font size=4><strong>Parameters</strong></font></p> <p><code class=highlight><span class=kc>None</span></code></p> <p><font size=4><strong>Returns</strong></font></p> <table> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><code class=highlight><span class=n>AbstractUser</span></code></td> <td>A Django <code class=highlight><span class=n>User</span></code>, which can also be an <code class=highlight><span class=n>AnonymousUser</span></code>.</td> </tr> </tbody> </table> </details> <hr> <div class=md-source-file> <small> Last update: <span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date">June 19, 2024</span> </small> </div> <div class=md-source-date> <small> Authors: <span class="git-page-authors git-authors"><a href=mailto:[email protected]>Mark Bakhit</a></span> </small> </div> </article> </div> </div> <button type=button class="md-top md-icon" data-md-component=top hidden> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12Z"/></svg> Back to top </button> </main> <footer class=md-footer> <div class="md-footer-meta md-typeset"> <div class="md-footer-meta__inner md-grid"> <div class=md-copyright> <div class=md-copyright__highlight> © <div id=year></div> <script>document.getElementById("year").innerHTML = new Date().getFullYear();</script> Reactive Python and affiliates. <div class=legal-footer-right>This project has no affiliation to ReactJS or Meta Platforms, Inc.</div> </div> </div> </div> </div> </footer> </div> <div class=md-dialog data-md-component=dialog> <div class="md-dialog__inner md-typeset"></div> </div> <script id=__config type=application/json>{"base": "../..", "features": ["navigation.instant", "navigation.tabs", "navigation.tabs.sticky", "navigation.top", "content.code.copy", "search.highlight"], "search": "../../assets/javascripts/workers/search.a264c092.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": {"provider": "mike"}}</script> <script src=../../assets/javascripts/bundle.4e0fa4ba.min.js></script> <script src=../../assets/js/main.js></script> </body> </html> | ||
</code></pre></div></td></tr></table></div> </div> </div> </div> <details class=example> <summary>See Interface</summary> <p><font size=4><strong>Parameters</strong></font></p> <p><code class=highlight><span class=kc>None</span></code></p> <p><font size=4><strong>Returns</strong></font></p> <table> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><code class=highlight><span class=n>AbstractUser</span></code></td> <td>A Django <code class=highlight><span class=n>User</span></code>, which can also be an <code class=highlight><span class=n>AnonymousUser</span></code>.</td> </tr> </tbody> </table> </details> <hr> <div class=md-source-file> <small> Last update: <span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date">September 24, 2024</span> </small> </div> <div class=md-source-date> <small> Authors: <span class="git-page-authors git-authors"><a href=mailto:[email protected]>Mark Bakhit</a></span> </small> </div> </article> </div> </div> <button type=button class="md-top md-icon" data-md-component=top hidden> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12Z"/></svg> Back to top </button> </main> <footer class=md-footer> <div class="md-footer-meta md-typeset"> <div class="md-footer-meta__inner md-grid"> <div class=md-copyright> <div class=md-copyright__highlight> © <div id=year></div> <script>document.getElementById("year").innerHTML = new Date().getFullYear();</script> Reactive Python and affiliates. <div class=legal-footer-right>This project has no affiliation to ReactJS or Meta Platforms, Inc.</div> </div> </div> </div> </div> </footer> </div> <div class=md-dialog data-md-component=dialog> <div class="md-dialog__inner md-typeset"></div> </div> <script id=__config type=application/json>{"base": "../..", "features": ["navigation.instant", "navigation.tabs", "navigation.tabs.sticky", "navigation.top", "content.code.copy", "search.highlight"], "search": "../../assets/javascripts/workers/search.a264c092.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": {"provider": "mike"}}</script> <script src=../../assets/javascripts/bundle.4e0fa4ba.min.js></script> <script src=../../assets/js/main.js></script> </body> </html> |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.