void catchRouteChangeEvents(
Event e,
detail
)

Listening for user interaction.

Every router element is listening for 'tap' events on any html elements with data-router="..." attributes.

Source

/// Listening for user interaction.
///
/// Every router element is listening for 'tap' events on any html elements with data-router="..." attributes.
@Listen("tap")
void catchRouteChangeEvents(Event e, detail) {
  if (!(e.target is Element)) return;
  Map<String, String> dataset = (e.target as Element).dataset;
  String route = dataset["router"];
  if (route != null) {
    _log.info("'$absoluteRoute' detected routing event: data-router=$route, stopping event propagation");
    e.stopPropagation();
    e.preventDefault();

    List<String> params = [];
    int a=1;
    String param = null;

    if (dataset["routerParam0"] != null) {
      throw "You have an element with data-router-param0, but first parameter should be data-router-param1";
    }

    while ((param = dataset["routerParam$a"]) != null ) {
      a++;
      _log.fine("'$absoluteRoute' adding route parameter $a=$param");
      params.add(param);
    }

    if (route.startsWith("#/")) {
      route = route.substring(1);
      navigateAbsolute(route, params);

    } else if (route.startsWith("../")) {
      route = route.substring(3);
      navigateToSibling(route, params);

    } else if (route.startsWith("./")) {
      route = route.substring(2);
      navigateToChild(route, params);

    } else {
      throw "Your data-router must start with '#/' or '../' or './'";
    }
  }
}