The onHashChange method in src/controller/Base.mjs should be enhanced to provide more context to route handlers (handler, preHandler, defaultRoute).
Currently, handlers receive (params, value, oldValue). The value object, which comes from HashHistory, contains information about the hash change. This value object should be enhanced to include a capturedRoute property, which would be the string of the route pattern that was matched.
Acceptance Criteria:
- When a specific route is matched, the
value object passed to its preHandler (if any) and handler should contain a capturedRoute property with the matching route key (e.g., /users/{userId}).
- When no specific route is matched and a
defaultRoute is configured, the value object passed to the default handler should contain capturedRoute: 'default'.
- When no route is matched and no
defaultRoute is configured, the value object passed to onNoRouteFound should contain capturedRoute: null.
This will allow handlers to have more context about which route pattern triggered them, which can be useful for analytics, logging, or dynamic behavior.
The
onHashChangemethod insrc/controller/Base.mjsshould be enhanced to provide more context to route handlers (handler,preHandler,defaultRoute).Currently, handlers receive
(params, value, oldValue). Thevalueobject, which comes fromHashHistory, contains information about the hash change. Thisvalueobject should be enhanced to include acapturedRouteproperty, which would be the string of the route pattern that was matched.Acceptance Criteria:
valueobject passed to itspreHandler(if any) andhandlershould contain acapturedRouteproperty with the matching route key (e.g.,/users/{userId}).defaultRouteis configured, thevalueobject passed to the default handler should containcapturedRoute: 'default'.defaultRouteis configured, thevalueobject passed toonNoRouteFoundshould containcapturedRoute: null.This will allow handlers to have more context about which route pattern triggered them, which can be useful for analytics, logging, or dynamic behavior.