[Prototype-core] Re: Suggestion: DOM storage methods to Prototype

2009-09-29 Thread Mark Holton
On Tue, Sep 29, 2009 at 7:12 AM, andris andris.rein...@gmail.com wrote:


 Hi,

 I've implemented a simple library on the top of DOM storage and IE
 userData to act as a browser side caching solution called DOMCached
 (www.domcached.com). The library acts like a kind of javascript
 memcached caching solution - a script can store objects to the cache
 and retrieve it later on another pageview.

 For example if the user is already made an Ajax request and the data
 is stored to the DOMCache then there is no need to do this request to
 the server again. Or if you try to fill out a form and your browser
 crashes - if the data was stored to the cache by the script then
 nothing is lost when you re-open the form. And so on, the
 possibilities are endless.

 Anyhow - I was wondering if similar functionality (or DOMCached
 itself) could be added to the Prototype library?


 Best regards,
 Andris Reinman


+1
As a user of Prototype, I'd like to see something like this added.  Clean,
simple and useful.
Mark

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype: Core group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to 
prototype-core-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~--~~~~--~~--~--~---



[Prototype-core] Re: Suggestion: DOM storage methods to Prototype

2009-09-29 Thread Mark Holton
On Tue, Sep 29, 2009 at 1:37 PM, kangax kan...@gmail.com wrote:



 I can't speak for everyone in the core, but most definitely not. This
 is clearly more suited for a standalone module.


Actually, you changed my [user] mind.  Module makes more sense.  Core libs
shouldn't get bloated.

(but this is good to know about, thanks!)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype: Core group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to 
prototype-core-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~--~~~~--~~--~--~---



[Prototype-core] Re: Foreach Loops

2008-09-16 Thread Mark Holton
I agree with you, Simon.  The solutions that iterate over the loop 2x have
poorer BigO than the grep method.  That is, as the array size increases, the
two iterations are O(N^2), while the grep method is more on the order of
O(N).



On Tue, Sep 16, 2008 at 9:08 AM, Simon Charette [EMAIL PROTECTED]wrote:

 Sorry Yannick,
 but even if I agree with you that findAll().each() is the 'Prototype' way
 which i would prefer to the grep method i suggested.
 It still creates two iterations while the grep solutions doesn't.

 Thats the main reason why i suggested this formula.

 2008/9/16 Yanick [EMAIL PROTECTED]


 I have seen two responses using filter().each() (or grep().each()) and
 I just wanted to say that, IMHO, this is not good practice, and thus
 should not be recommanded as this creates two iterations over the same
 array for the same purpose and encourages bad coding habbits. The
 question is not would this work? but rather is this the best way?
 The OP must've felt the same way, otherwise he would've used such
 double sequential loops way in the first place. In fact, what T.J.
 Crowder suggested is the most Prototype way. I hope we'll all learn
 from this :)

 yanick


 On Sep 15, 12:24 pm, Grant Hutchins [EMAIL PROTECTED] wrote:
  It seems to me that Enumerable#findAll (aliased as select) is what you
  want for your first example.
 
  myArray.findAll( function(obj){ obj.className ==
  'MyProtoClass' } ).each( function(obj){ obj.doStuff } );
 
  This way you're using the official Prototype way to do these
  operations.
 
  Grant
 
  On Sep 11, 6:17 pm, EMoreth [EMAIL PROTECTED] wrote:
 
   Working with prototype from a long time ago I always need a function
   that could do something just like the Strongly Type languages, as Java
   or many others, that is a for ( ObjectClass object in
   arrayLikeStructure ) to get all objects from that array that are from
   the class ObjectClass and do something...
 
   Since Javascript does not have this kind of Typed Class its is very
   hard and annoying to do such thing... I recently tought two ways that
   could make it work...
 
   First (and simpler) is a foreach function that applyes on Enumerable
   items and Accepts two functions.. the first one is a boolean that will
   tell the code when the object is the class/type that I want, and the
   second function should be the action at real... to apply in that
   object. Something like :
 
   myArray.foreach(function(obj){ return obj.className ==
   'MyProtoClass'}, function(obj) { obj.doStuff() })
 
   The second one is just a little different (more Java-Like)... in this
   case we would need a previous custom method on all objects that would
   say if this one matches a defined parameter or not... something like
 
   a.className = 'MyClass';
   b.className = 'MyProtoClass';
 
   a.isMyObject = function(check) { return this.className == check }
   b.isMyObject = function(check) { return this.className == check }
 
   myArray.foreach( 'MyProtoClass', function(obj) { obj.doStuff() })
 
   and it would only apply on b.doStuff()
 
   I cant tell if this would have the same utility for everyone that
   would have for me... But i thing that would be very good for people
   who are used to other Typed Languages...
 
   Please tell me what you think about that..
 
   EMoreth



 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype: Core group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~--~~~~--~~--~--~---