This repository has been archived on 2023-02-03. You can view files and clone it, but cannot push or open issues or pull requests.
autonomic.zone/js/_events.js

44 lines
836 B
JavaScript
Raw Normal View History

2017-08-31 11:44:57 +00:00
var cj = cj ? cj : {};
(function($) {
/**
* Publish events using Pub/Sub
* @namespace events
* @see {@link https://github.com/cowboy/jquery-tiny-pubsub}
*/
$.extend(cj, {
/**
* Publish event when the page is ready.
* @function pageReady
*/
pageReady: function() {
var self = this;
$.publish('pageReady_prioritise', self);
$.publish('pageReady', self);
self.pageLoaded();
},
/**
* Publish event when the page has loaded.
* @function pageLoaded
*/
pageLoaded: function() {
var self = this;
self.settings.$window.on('load', function() {
$.publish('pageLoaded', self);
});
},
/**
* Publish event when an AJAX request has finished.
* @function ajaxLoaded
*/
ajaxLoaded: function() {
var self = this;
$.publish('ajaxLoaded', self);
}
});
}(jQuery));