This commit is contained in:
Baris Soner Usakli
2014-02-27 23:45:12 -05:00
parent 0682b5c5ea
commit 091723a8c5
8 changed files with 251 additions and 30 deletions

View File

@@ -21,8 +21,9 @@ var ajaxify = {};
window.onpopstate = function (event) {
if (event !== null && event.state && event.state.url !== undefined && !ajaxify.initialLoad) {
ajaxify.go(event.state.url, null, true);
$(window).trigger('action:popstate', {url: event.state.url});
ajaxify.go(event.state.url, function() {
$(window).trigger('action:popstate', {url: event.state.url});
}, true);
}
};
@@ -30,6 +31,7 @@ var ajaxify = {};
ajaxify.initialLoad = false;
ajaxify.go = function (url, callback, quiet) {
// "quiet": If set to true, will not call pushState
app.enterRoom('global');
@@ -102,7 +104,7 @@ var ajaxify = {};
}
});
if (callback) {
if (typeof callback === 'function') {
callback();
}