You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The router module is responsible for registering routes, linking pages, and configuring URLs.
configureLink
Parameters/Input:
linkInfo: object
The configureLink() function expects an object containing specific information about the element intended to act as a link, and it adds a click event listener to it. Here's the expected object structure:
All the properties mentioned above are required, except for host. host is a selector that determines where to (in this case, 'home') should be rendered. If host is not provided, the function should append the contents inside #root. The to property should be a valid id corresponding to objects stored in a private array within router called pages. If these constraints are not met, the function should throw an error.
The router should maintain a private array to keep track of all the links, and configureLink() should push the linkInfo object into this array after validation.
The function should then create a click event listener that, when triggered, finds a page with an id matching the value of linkInfo.to. It should use domManager(page, host) to create the element. After creating the element, the function should invoke activateLink() and deactivateLinks() with linkInfo.name as a parameter. deactivateLinks() should be invoked first.
The text was updated successfully, but these errors were encountered:
router.configureLink
router
The
router
module is responsible for registering routes, linking pages, and configuring URLs.configureLink
Parameters/Input:
linkInfo
: objectThe
configureLink()
function expects an object containing specific information about the element intended to act as a link, and it adds a click event listener to it. Here's the expected object structure:All the properties mentioned above are required, except for
host
.host
is a selector that determines whereto
(in this case, 'home') should be rendered. Ifhost
is not provided, the function should append the contents inside#root
. Theto
property should be a valid id corresponding to objects stored in a private array withinrouter
calledpages
. If these constraints are not met, the function should throw an error.The
router
should maintain a private array to keep track of all the links, andconfigureLink()
should push thelinkInfo
object into this array after validation.The function should then create a click event listener that, when triggered, finds a page with an id matching the value of
linkInfo.to
. It should usedomManager(page, host)
to create the element. After creating the element, the function should invokeactivateLink()
anddeactivateLinks()
withlinkInfo.name
as a parameter.deactivateLinks()
should be invoked first.The text was updated successfully, but these errors were encountered: