How to use the method ClearHistory() from HierarchicalNavigation

I have a HierarchicalNavigation that I need to call ClearHistory() in certain situations. But I didn’t find how to call components methods from ux, or how to access components from javascript. Using the name definied in ux:Name doesn’t work. It shows the error: Name: ReferenceError: nav is not defined (nav is the ux:Name).