Skip to content

Commit

Permalink
fix(demo): Behaviors > Advanced > Dispatch Event (#1050)
Browse files Browse the repository at this point in the history
  • Loading branch information
flochtililoch authored Jan 23, 2025
1 parent 6e71b7d commit 09cfebb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
7 changes: 1 addition & 6 deletions demo/backend/behaviors/advanced/dispatch/index.xml.njk
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,8 @@ hv_button_behavior: "back"
style="main"
trigger="on-event"
>
{{ description('Dispatch events to load screens') }}
{{ description('Dispatching an event is useful for cross-screen communication. This screen listens for the event `test-event` and appends content upon receipt. Press the button below and follow the instructions.') }}
{% call button('Open new screen', attributes={href:"/hyperview/public/behaviors/advanced/dispatch/source-screen.xml"}) -%}
<behavior
action="dispatch-event"
event-name="test-event"
trigger="press"
/>
{%- endcall %}
</view>
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,17 @@ hv_button_behavior: "back"
{% from 'macros/description/index.xml.njk' import description %}

{% block content %}
{{ description('Dispatch events to load previous screen') }}
{% call button('Reload previous') -%}
{{ description('Pressing the button below will emit the event `test-event` and navigate you back to the previous screen, with new content added.') }}
{% call button('Dispatch event & go back') -%}
<behavior
action="dispatch-event"
event-name="test-event"
trigger="press"
/>
<behavior
trigger="press"
action="back"
href="#"
/>
{%- endcall %}
{% endblock %}

0 comments on commit 09cfebb

Please sign in to comment.