arieh / historymanager Goto Github PK
View Code? Open in Web Editor NEWa mootools history-manager / obeserver class
a mootools history-manager / obeserver class
When setting a new value to a list, only the first index is sent to the #-changed event handler:
var HM = new HistoryManager();
HM.addEvent('xxx-changed', function(val) {console.log(val)});
HM.start();
HM.set('xxx', [1]); // logs 1
HM.set('xxx', [1,2]); // logs 1
In line 120 (http://github.com/arieh/HistoryManager/blob/master/Source/HashListener.js#L120) there is a typo. It should be 'gecko' not 'geko', I think.
Hi,
First of all, nice component!
I've noticed one unexpected behaviour. If you set multiple values in HM in say a click handler only the last one is set.
I think this is because in HM.set, this.state is not yet updated between the two calls. It is not updated because in HL.setHash, 'onhashchange' is in window and document.documentNode is undefined (FF 8,9 W7 64 bit)
$('mybutton').addEvent('click', function ()
{
HM.set('txt1', 'example1');
HM.set('txt2', 'example2');
});
If this plugin is mostly based on somebody else's work, you should provide a proper credit/copyright. Just a friendly hint of a sad developer.
Hi, First of all, congrats on the GREAT work! Ill be trying it in my projects from now.
My Web App is a reporting aplication, and it uses AJAX to load reports, when selected from the menu.
I need to do something like Hierarchy tags. Ill do an exemple:
Supose i have 2 functions requested via AJAX. One is for reports, and it have aditional configs (like id) and the other doesnt.
Report A) index.php/#{"page":{"name":"reports","id":"25648"},"something":"111"}
Report B) index.php/#{"page":{"name":"reports","id":"48441"},"something":"111"}
Report B+config) index.php/#{"page":{"name":"reports","id":"48441","vision":"xxx"},"something":"111"}
Help Page) index.php/#{"page":{"name":"help"},"something":"111"}
On the Report B+config, i would like to register something like:
HM.addEvent('page.vision-changed',function...
Note the page.vision syntax. Would it be posible? An array syntax. Maybe only 2 or 3 levels are needed... (no recursion needed)
There is another thing. As the reports are loaded via AJAX, they need to register on the HM to listen to events. But when i load one of them the second time, they register again for listening. So the solution i found was to use HM.removeEvents('-something:changed');
Is there a better way?
If you have more tips on AJAX+HistoryManager, please let me know!
Thx in advance!
Your plugin has been a great help to me.
I only get the last page even though a user may have clicked it two or three times. This occurs when these clicks happen in quick succession. Is this my problem or something that is inherent or something that can be fixed?
thanks!
Hi arieh,
very good job! I will use your HistoryManager in my site, but I have a problem with your updateState Function. When I add "select":"L1;" and then add "b":"hide" the funktion fire the select-changed event.
But when I add "select":"L1;L2;" and then add "b":"hide" the funktion do not fire the select-changed event. Why?
The second case is the case I want.
Greetings from Germany
Benedikt
Not sure if this works in Safari 3 (Mac), but in Safari 4 it fails. I think you have to unescape the URL in the getHash method (HashListener.js) at line 124 like so:
return unescape(window.location.hash.substr(1));
This should fix the problem.
Hi Arieh,
This is a great plugin you published here. I'm using the HashListener part for some basic ajax loading and all works well except one little thing :
I wonder if it is browser limitation, or if there is a way to handle it ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.