Routing, Themes and Analytics
Prithvi Prabhu
Chief of Technology @ H2O.aiWave v0.12 shipped last week, with support for handling queries and routes using decorators and experimental support for switching themes. Here's a rundown of the major features.
Routing
In most Wave applications, queries are typically handled using if/elif/else
conditionals that in turn call other functions:
As your application gets larger, using if/elif/else
for routing can seem tedious or repetitive. Starting with Wave 0.12, you can use the new @on()
and handle_on()
functions to reduce boilerplate:
The handle_on()
function analyzes the incoming query and calls the matching @on()
function. There's also support for specifying patterns (@on('#menu/donuts/{donut_name}')
) and matching query arguments (@on('buy_donut')
).
Using @on()
and handle_on()
functions are entirely optional.
Learn how to use routes in the guide: Routing and Query Arguments.
See example: Routing
Themes
Wave v0.12 also ships with experimental support for switching themes, and includes a new neon
dark theme. To switch your app's theme, simply set the theme
attribute of your app's meta_card
.
See example: Theme
Web Analytics
You can now configure your app to send basic usage information to Google Analytics. You can use this feature to measure analyze how users are interacting with various parts of your app.
To enable usage tracking, use the new ui.tracker()
API to set the tracker
attribute of your app's meta_card
.
Read more about configuring analytics: Configuration
See example: Tracking
Download
Get the release here. Check out the release notes for more details.
We look forward to continuing our collaboration with the community and hearing your feedback as we further improve and expand the H2O Wave platform.
We’d like to thank the entire Wave team and the community for all of the contributions to this work!