Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update Readme with new API.

  • Loading branch information...
commit 4a7e9ebce05d7b1473eff6eac55bd7e19e61edd5 1 parent db5dae4
@rstacruz rstacruz authored
Showing with 23 additions and 15 deletions.
  1. +23 −15 README.md
View
38 README.md
@@ -15,38 +15,39 @@ This project is a member of the [OSS Manifesto](http://ossmanifesto.org/).
## Usage
Gemfile:
+
``` js
gem 'jquery-turbolinks'
```
-JavaScript manifest file:
+Add it to your JavaScript manifest file, in this order:
+
``` js
+//= require jquery
//= require jquery.turbolinks
+//
+// ... your other scripts here ...
+//
+//= require turbolinks
```
And it just works!
-## Customization
-
-### $.setReadyEvent
+## API and Customization
-By default [ready](https://github.com/kossnocorp/jquery.turbolinks/blob/master/src/jquery.turbolinks.coffee#L17:L18) function is bound to [page:load](https://github.com/rails/turbolinks/#events) event.
+### $.turbo.use
-If you want to change it use `$.setReadyEvent` function:
+By default, jQuery.Turbolinks is bound to [page:load] and [page:fetch]. To use
+different events (say, if you're not using Turbolinks), use:
``` js
-$.setReadyEvent('page:change');
+$.turbo.use('pjax:start', 'pjax:end');
```
-### $.setFetchEvent
-
-By default right after trigger `page:fetch` `$.isReady` is set to false. And after `page:load` is set to true.
-
-If you want to change default behaviour you can use `$.setFetchEvent`:
+## $.turbo.isReady
-``` js
-$.setReadyEvent('custom_loading_event');
-```
+You can check if the page is ready by checking `$.turbo.isReady`, which will be
+either `true` or `false` depending on whether the page is loading.
## Troubleshooting
@@ -72,6 +73,10 @@ $(document).on('click', 'button', function() { ... })
This project uses [Semantic Versioning](http://semver.org/) for release numbering.
+### 2.0.0
+
+* New API.
+
### 1.0.0 (April 5, 2013)
* Add uglified version.
@@ -112,3 +117,6 @@ Initial idea and code by [@kossnocorp](http://koss.nocorp.me/), with special tha
## License
[The MIT License](https://github.com/kossnocorp/jquery.turbolinks/blob/master/LICENSE.md)
+
+[page:load]: https://github.com/rails/turbolinks/#events
+[page:fetch]: https://github.com/rails/turbolinks/#events
Please sign in to comment.
Something went wrong with that request. Please try again.