Add Typescript definitions (#138)

* Add Typescript definitions
* Add test file for TS
This commit was merged in pull request #138.
This commit is contained in:
BehindTheMath
2018-03-15 21:16:11 -04:00
committed by GitHub
parent a2982cfcba
commit 5e41a32cf4
4 changed files with 236 additions and 4 deletions

View File

@@ -413,7 +413,7 @@ However, there is almost no use case where you would want to do that.
Internally, this option is used when a `popstate` event triggers Pjax (to not `pushState()` again).
##### `analytics` (Function|Boolean, default: a function that pushes `_gaq` `_trackPageview` or sends `ga` `pageview`
##### `analytics` (Function | Boolean, default: a function that pushes `_gaq` `_trackPageview` or sends `ga` `pageview`
Function that allows you to add behavior for analytics. By default it tries to track
a pageview with Google Analytics (if it exists on the page).
@@ -421,9 +421,13 @@ It's called every time a page is switched, even for history navigation.
Set to `false` to disable this behavior.
##### `scrollTo` (Integer, default: `0`)
##### `scrollTo` (Integer | \[Integer, Integer\] | False, default: `0`)
Value (in px from the top of the page) to scroll to when a page is switched.
When set to an integer, this is the value (in px from the top of the page) to scroll to when a page is switched.
When set to an array of 2 integers (\[x, y\]), this is the value to scroll both horizontally and vertically.
Set this to `false` to disable scrolling, which will mean the page will stay in that same position it was before loading the new elements.
##### `scrollRestoration` (Boolean, default: `true`)
@@ -606,7 +610,7 @@ Clone this repository and run `npm run example`, which will open the example app
* ⇄ Pull requests and ★ Stars are always welcome.
* For bugs and feature requests, please create an issue.
* Pull requests must be accompanied by passing automated tests (`npm test`).
* Pull requests must be accompanied by passing automated tests (`npm test`). If the API is changed, please update the Typescript definitions as well (`pjax.d.ts`).
## [CHANGELOG](CHANGELOG.md)