[Helma-user] markAsClean
Kris Leite
kleite at imcsoftware.com
Mon May 5 06:09:03 CEST 2008
Using getter/setters for this is possible. I find the simple assignment
statement in onInit to be much less code, execute overhead, and
debugging needed. The markAsClean function can be useful in other
situations besides this one.
Joshua Paine wrote:
> On Sun, 2008-05-04 at 18:49 -0700, Kris Leite wrote:
>
>> In my case, it was much better to
>> create HopObject fields with default values. If the user changed the
>> default values, then they are stored. If nothing was entered, then
>> the default values are not stored reducing storage overhead.
>>
>
> This would probably be even better accomplished like this:
>
> this.__defineGetter('favColor',function(){
> return this.favColor_ === undefined ? 'red' : this.favColor_;
> });
> this.__defineSetter('favColor',function(val){
> val == 'red' ? (delete this.favColor_) : this.favColor_ = val;
> return val;
> });
>
>
More information about the Helma-user
mailing list