Backbone.js History()

The Backbone.JS History() is a global router. It serves various purposes including,

  • keeping track of the history
  • matching the appropriate route
  • triggering callbacks to handle events
  • enabling routing in the application
  • There is only one method to manipulate, modify or operate the History in Backbone.JS.

    Backbone.js History.Start method:
    The Backbone.js History.Start method is used to start the monitoring of the hashchange events, and dispatching routes after all the Routers have been created, and all the routes have been set.

    Syntax:

    Backbone.history.start (options)   
    

    Parameters:
    options: This parameter is used to specify the other parameters like pushState and hashChange.

    Example:

    
      
    
      
    Example  
      
      
      
      
      
      
    

    Output:

    ●	Route 1
    ●	Route 2
    ●	Route 3
    ●	Route 4
    ●	Route 5