A Registry Class for Mootools

Thursday, December 4th, 2008 @ 11:05 am | filed under: Code Releases, MooTools, Organizing Code

Nathan White has posted over on his blog a nice bit of work. He’s released a registry class for MooTools that lets you do stuff like this:

var reg = new Registry();
reg.set('/Options/Default',{'name' : 'test', 'version' : 1});
reg.set('/Options/Default/name', 'changed');
reg.set('/dynamically/creates/nested/objects', true);
reg.get('/Options/Default');
/* returns {  name : 'changed',  version : 1 } */
reg.get('/Options/Default/version'); // returns 1

I have an extension to Hash in my libraries that lets you get a value from a path but it isn’t bi-directional – you can’t push data in using a path. Nice work Nathan!

No TweetBacks yet. (Be the first to Tweet this post)

Comments are closed.