Permalink
Browse files

Use a different/better history manager, fixes #40.

  • Loading branch information...
1 parent 5f87e2a commit bf8d2f4ab791eae640f1f41b84002b396bdeee7a @eventualbuddha eventualbuddha committed Feb 8, 2011
@@ -0,0 +1,63 @@
+// History.js jQuery Adapter
+// New-BSD License, Copyright 2011 Benjamin Arthur Lupton <contact@balupton.com>
+
+(function($,window,undefined){
+
+ // --------------------------------------------------------------------------
+ // Initialise
+
+ // History Object
+ window.History = window.History||{};
+
+ // Localise Globals
+ var
+ History = window.History||{},
+ history = window.history;
+
+ // Check Existence of Adapter
+ if ( typeof History.Adapter !== 'undefined' ) {
+ throw new Error('History.js Adapter has already been emulated...');
+ }
+
+ // Add the Adapter
+ History.Adapter = {
+
+ /**
+ * History.Adapter.bind(el,event,callback)
+ * @param {element} el
+ * @param {string} event
+ * @param {Function} callback
+ * @return {element}
+ */
+ bind: function(el,event,callback){
+ return $(el).bind(event,callback);
+ },
+
+ /**
+ * History.Adapter.trigger(el,event)
+ * @param {element} el
+ * @param {string} event
+ * @return {element}
+ */
+ trigger: function(el,event){
+ return $(el).trigger(event);
+ },
+
+ /**
+ * History.Adapter.trigger(el,event,data)
+ * @param {Function} callback
+ * @return {true}
+ */
+ onDomLoad: function(callback) {
+ jQuery(callback);
+ }
+
+ };
+
+ // Check Load Status
+ if ( typeof History.init !== 'undefined' ) {
+ // History.js loaded faster than the Adapter, Fire init
+ History.init();
+ }
+
+})(jQuery,window);
Oops, something went wrong.

0 comments on commit bf8d2f4

Please sign in to comment.