Skip to main content
Views are the interactive layer of Multisynq applications - they handle user input, display model state, and provide the user interface. Unlike models, views have full access to browser APIs and can use any JavaScript libraries. However, they must follow specific patterns to maintain synchronization.

Core Principle: Read-Only Model Access

THE MOST IMPORTANT RULE: Views must NEVER write directly to the model. All model changes must go through events.
Views read from model, publish events for changes

View Architecture Patterns

🏗️ Modular Design

Create specialized sub-views

📡 Event Communication

Proper event-driven architecture

View Lifecycle and Updates

Optimize view updates for performance

Input Handling Best Practices

Handle game controls efficiently
Handle mobile touch interactions
Provide immediate feedback for responsive UI

Best Practices Summary

🔒 Synchronization

Maintain perfect sync
  • Never write directly to model
  • Always use events for changes
  • Read model state for display
  • Handle predictions carefully

⚡ Performance

Optimize rendering
  • Use efficient change detection
  • Implement partial updates
  • Throttle high-frequency events
  • Cache expensive calculations

🎮 User Experience

Responsive interaction
  • Provide immediate feedback
  • Use predictive animations
  • Handle edge cases gracefully
  • Support multiple input methods

🏗️ Architecture

Clean organization
  • Use modular sub-views
  • Separate concerns clearly
  • Handle lifecycle properly
  • Document event interfaces

View vs Model Responsibilities

What views should handle

Common Mistakes

Avoid these common view development errors:

Next Steps

Writing a Multisynq Model

Learn to build the synchronized models that power your views

Events & Pub-Sub

Master communication between models and views

Simple Animation

See view patterns in action with animated examples

Multi-user Chat

Build interactive multi-user interfaces
Views are where your application comes to life for users. By following the read-only model principle and using events for all changes, you can build responsive, interactive interfaces that work perfectly across all users while maintaining the deterministic behavior required for synchronization.