silverstripe-framework/admin/thirdparty/history-js/scripts/uncompressed/history.adapter.zepto.js

59 lines
1.3 KiB
JavaScript
Raw Normal View History

2011-05-20 05:49:30 +02:00
/**
* History.js Zepto Adapter
* @author Benjamin Arthur Lupton <contact@balupton.com>
* @copyright 2010-2011 Benjamin Arthur Lupton <contact@balupton.com>
* @license New BSD License <http://creativecommons.org/licenses/BSD/>
*/
// Closure
(function(window,undefined){
// Localise Globals
var
History = window.History = window.History||{},
Zepto = window.Zepto;
// Check Existence
if ( typeof History.Adapter !== 'undefined' ) {
throw new Error('History.js Adapter has already been loaded...');
}
// Add the Adapter
History.Adapter = {
/**
* History.Adapter.bind(el,event,callback)
* @param {Element|Selector} el
* @param {String} event - custom and standard events
* @param {Function} callback
* @return
*/
bind: function(el,event,callback){
Zepto(el).bind(event,callback);
},
/**
* History.Adapter.trigger(el,event)
* @param {Element|Selector} el
* @param {String} event - custom and standard events
* @return
*/
trigger: function(el,event){
Zepto(el).trigger(event);
},
/**
* History.Adapter.trigger(el,event,data)
* @param {Function} callback
* @return
*/
onDomLoad: function(callback) {
Zepto(callback);
}
};
// Try and Initialise History
if ( typeof History.init !== 'undefined' ) {
History.init();
}
})(window);