Last active
January 1, 2016 09:09
-
-
Save kamiyam/8122821 to your computer and use it in GitHub Desktop.
main.coffee for jquery.pjax.js (https://github.com/falsandtru/jquery.pjax.js)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
do ( d = document, w = window, $ = jQuery ) -> | |
# Simple log function to keep the example simple | |
log = -> | |
console.log.apply console, arguments if typeof console isnt "undefined" | |
$ -> | |
viewArea = "#contents" | |
$.pjax | |
area: viewArea | |
scrollTop: null | |
scrollLeft: null | |
load: | |
script: true | |
css: true | |
wait: 500 | |
parameter: 'callback' | |
callback: ( event, arg )-> | |
log( arg + ': callback' ) | |
$(viewArea).animate | |
opacity : 1 | |
callbacks: | |
before: ( event, arg ) -> | |
log( arg + ': before' ) | |
$(viewArea).animate | |
opacity : 0 | |
500 | |
ajax: | |
beforeSend: ( event, arg ) -> | |
log( arg + ': ajax.beforeSend' ) | |
dataFilter: ( event, arg, data ) -> | |
log( arg + ': ajax.dataFilter' ) | |
return data | |
success: ( event, arg ) -> | |
log( arg + ': ajax.success' ) | |
error: ( event, arg ) -> | |
log( arg + ': ajax.error' ) | |
update: | |
success: ( event, arg ) -> | |
log( arg + ': update.success' ) | |
error: ( event, arg ) -> | |
log( arg + ': update.error' ) | |
complete: ( event, arg ) -> | |
log( arg + ': update.complete' ) | |
after: ( event, arg )-> | |
log( arg + ': after' ) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment