Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Update Readme with new API.
Browse files Browse the repository at this point in the history
  • Loading branch information
rstacruz committed Aug 21, 2013
1 parent db5dae4 commit 4a7e9eb
Showing 1 changed file with 23 additions and 15 deletions.
38 changes: 23 additions & 15 deletions README.md
Expand Up @@ -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

Expand All @@ -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.
Expand Down Expand Up @@ -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

0 comments on commit 4a7e9eb

Please sign in to comment.