X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=Roo%2FHistory.js;h=91ae8d22f71197b3e0a5a4c5f89d7ca2f31ac0da;hb=61bc45258e16a779856dd2ad0862630b489e4583;hp=89d67c2d7542e4b27924c2f0f73f91e8dc3d3b07;hpb=54cc3bc356954453a70d00d82e2ffde0be1c5e9f;p=roojs1 diff --git a/Roo/History.js b/Roo/History.js index 89d67c2d75..91ae8d22f7 100644 --- a/Roo/History.js +++ b/Roo/History.js @@ -1,18 +1,23 @@ /** * Originally based of this code... - refactored for Roo... - * + * https://github.com/browserstate/history.js + * History.js Core * @author Benjamin Arthur Lupton * @copyright 2010-2011 Benjamin Arthur Lupton * @license New BSD License + * + * Hackily modifyed by alan@roojs.com + * + * this is not initialized automatically.. + * must call Roo.History.init( { ... options... }); + * + * TOTALLY UNTESTED... + * + * Documentation to be done.... */ - -// this is not initialized automatically.. -// must call Roo.History.init( { ... options... }); - - -Roo.History = new Roo.util.Observable({ +Roo.History = { // ==================================================================== @@ -208,20 +213,14 @@ Roo.History = new Roo.util.Observable({ Roo.apply(this,options) - // Check Load Status of Adapter - //if ( typeof this.Adapter === 'undefined' ) { - // return false; - //} - + // Check Load Status of Core - if ( typeof this.initCore !== 'undefined' ) { - this.initCore(); - } - + this.initCore(); + // Check Load Status of HTML4 Support - if ( typeof this.initHtml4 !== 'undefined' ) { - this.initHtml4(); - } + //if ( typeof this.initHtml4 !== 'undefined' ) { + // this.initHtml4(); + //} this.initEmulated(); @@ -241,7 +240,7 @@ Roo.History = new Roo.util.Observable({ - this.Adapter.bind(window,'popstate',this.onPopState); + Roo.get(window).on('popstate',this.onPopState, this); /** @@ -258,8 +257,8 @@ Roo.History = new Roo.util.Observable({ this.intervalList.push(setInterval(this.onUnload,this.storeInterval)); // For Other Browsers - this.Adapter.bind(window,'beforeunload',this.onUnload); - this.Adapter.bind(window,'unload',this.onUnload); + Roo.get(window).on('beforeunload',this.onUnload,this); + Roo.get(window).on('unload',this.onUnload, this); } else { this.onUnload = emptyFunction; @@ -270,7 +269,7 @@ Roo.History = new Roo.util.Observable({ /** * Clear Intervals on exit to prevent memory leaks */ - this.Adapter.bind(window,"unload",this.clearAllIntervals); + Roo.get(window).on('unload',this.clearAllIntervals, this); /** * Create the initial State @@ -304,9 +303,9 @@ Roo.History = new Roo.util.Observable({ */ // Setup Alias - this.Adapter.bind(window,'hashchange',function(){ + Roo.get(window).on('hashchange',function(){ Roo.get(window).fireEvent('popstate'); - }); + }, this); // Initialise Alias if ( this.getHash() ) { @@ -1636,7 +1635,7 @@ Roo.History = new Roo.util.Observable({ // Apply the New State //this.debug('this.safariStatePoll: trigger'); - this.Adapter.trigger(window,'popstate'); + Roo.get(window).fireEvent('popstate'); // Chain return this; @@ -1786,7 +1785,7 @@ Roo.History = new Roo.util.Observable({ else { // Traditional Anchor //this.debug('this.onPopState: traditional anchor', currentHash); - this.Adapter.trigger(window,'anchorchange'); + Roo.get(window).fireEvent('anchorchange'); this.busy(false); } @@ -1838,7 +1837,7 @@ Roo.History = new Roo.util.Observable({ this.setTitle(newState); // Fire Our Event - this.Adapter.trigger(window,'statechange'); + Roo.get(window).fireEvent('statechange'); this.busy(false); // Return true @@ -1901,7 +1900,7 @@ Roo.History = new Roo.util.Observable({ history.pushState(newState.id,newState.title,newState.url); // Fire HTML5 Event - this.Adapter.trigger(window,'popstate'); + Roo.get(window).fireEvent('popstate'); } // End pushState closure @@ -1958,7 +1957,7 @@ Roo.History = new Roo.util.Observable({ history.replaceState(newState.id,newState.title,newState.url); // Fire HTML5 Event - this.Adapter.trigger(window,'popstate'); + Roo.get(window).fireEvent('popstate'); } // End replaceState closure @@ -2041,6 +2040,4 @@ Roo.History = new Roo.util.Observable({ } } } -}); - - \ No newline at end of file +}; \ No newline at end of file