Front-end SPA framework with jQuery and History.js
- Fix do not pass jqXHR to the fail controller. Push state throws an exception if the jqXHR hast status 404
- Hash is set while changing state, instead of after because it triggered a popstate event.
- Using native history. Dropped IE9. Use 1.1.0 if you need IE9 support.
- Changed .unbind to .off to comply with jquery v3
- Search queries remain on URL, and are still saved into the History state
- NEW! Controller factory with defaults! Convention over Customization and Don't Repeat Yourself principles FTW!
- set document title with route title
- beforeIntercept now has to call a callback, like onRouteChange
- URL search params get passed through the AJAX request
- fixed bug in IE with the pathname. Thanks to: http://stackoverflow.com/a/13405933/368850
- search part of the url (e.g. ?utm_campaign=helloworld) stored parsed as object in History state (
History.getState().data.search) - full path (path + search, e.g. /foo?bar=helloworld) stored in History state (
History.getState().data.fullPath). Usefull for tracking Google Analytics pageviews (ga('send', 'pageview', History.getState().data.fullPath);) - enhanced route parsing thanks to https://gist.github.com/jlong/2428561
- some comments refactored to JSDoc standard
- variable declarations refactored without separating them with ','
- changed the implementation of data-autoscroll for safer code, including the setting in the state object instead of being a nitram public property.
- if the route does not have a match with the configured routes, instead of calling the fail controller, now nitram does a redirect to that URL with window.location. Closes issue #4
- if the route does start with http:// or https://, we don't intercept it. Closes issue #4
- trim trailing slash of routes. Closes #5
- new param for onRouteChange, which now has to call a callback
- fix hash
- fixed situation when first controller got called twice
- failController
- distribution file not minified
- routes can work with hashes
- new .jshintrc applied
- updated dev dependencies to latest
- added nitram.beforeIntercept
- unit tests
- change nitram "object" into a real object with private functions
- demo
Nitram.js is released under the MIT license.