brainy-history-api-behavior

A set of utility functions for Polymer components using HTML5 history API


Keywords
web-components, pushstate, popstate, history, brainy
License
MIT
Install
bower install brainy-history-api-behavior#v0.1.0

Documentation

brainy-history-api-behavior

A set of utility functions for Polymer components using HTML5 history API

Install

bower install brainy-history-api-behavior --save

Description

The HTML5 history spec is a bit quirky. history.pushState() doesn't dispatch a popstate event or load a new page by itself. It was only meant to push state into history. This is an "undo" feature for single page applications. This is why you have to manually dispatch a popstate event.

Tis behavior offers a pushState method which will push the new state into history then dispatch a popstate event which you can use to load a new page with a router.