We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This documents the correct way to implement Hyperview behaviors in the Onyx app, based on lessons learned during GitHub auth implementation.
Behaviors must be registered in an array format in app/hyperview/behaviors/index.ts:
app/hyperview/behaviors/index.ts
export default [ AddStyles, ...WebSocketBehaviors, // Spread existing behavior arrays OpenUrlBehavior, // Add new behaviors ];
❌ Don't use object format:
export default { 'open-url': OpenUrlBehavior.callback, // Wrong! }
Each behavior should be defined as a HvBehavior object:
HvBehavior
export const OpenUrlBehavior: HvBehavior = { action: 'open-url', callback: async (element, context) => { // Implementation } };
Use style.display instead of hidden attribute for visibility:
style.display
hidden
<style id="loading" display="none" /> <text id="loading-text" style="loading">Loading...</text>
if (showDuringLoad) { const showElement = context.getElementByID(showDuringLoad); if (showElement) { showElement.style.display = 'flex'; } }
Iterator Error: If you see "iterator method is not callable", check behavior registration format. Must be array, not object.
Loading State Stuck: Use style.display manipulation instead of hidden attribute.
Behavior Not Triggering:
Multiple Behaviors: When adding multiple behaviors, spread them in the array:
export default [ AddStyles, ...WebSocketBehaviors, ...NewBehaviors ];
Add debug logging to track behavior execution:
callback: async (element, context) => { console.log('[BehaviorName] Triggered'); console.log('[BehaviorName] Attributes:', { href: element.getAttribute('href'), // other relevant attrs }); // Implementation }
See the GitHub auth implementation in:
app/hyperview/behaviors/OpenUrl/index.ts
templates/pages/auth/login.xml
For a complete working example of behavior implementation and usage.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hyperview Behavior Implementation Guide
This documents the correct way to implement Hyperview behaviors in the Onyx app, based on lessons learned during GitHub auth implementation.
Behavior Registration
Behaviors must be registered in an array format in
app/hyperview/behaviors/index.ts
:❌ Don't use object format:
Behavior Definition
Each behavior should be defined as a
HvBehavior
object:Loading State Management
Use
style.display
instead ofhidden
attribute for visibility:Common Issues & Solutions
Iterator Error: If you see "iterator method is not callable", check behavior registration format. Must be array, not object.
Loading State Stuck: Use
style.display
manipulation instead ofhidden
attribute.Behavior Not Triggering:
Multiple Behaviors: When adding multiple behaviors, spread them in the array:
Testing Behaviors
Add debug logging to track behavior execution:
Example Implementation
See the GitHub auth implementation in:
app/hyperview/behaviors/OpenUrl/index.ts
templates/pages/auth/login.xml
For a complete working example of behavior implementation and usage.
The text was updated successfully, but these errors were encountered: