documenting /src/foundation/gclib_date_extensions.js

0 views
Skip to first unread message

agent marmorkuchen

unread,
Mar 9, 2009, 2:00:43 PM3/9/09
to groundcrew-vie...@googlegroups.com
hello...

looking at /src/foundation/gclib_date_extensions.js:

- i see a few more functions starting with a $-sign. are these all
functions that somewhat exist in Perl as well? (i had been using Perl
quite a bit 10y ago, but somewhat missed these $-functions).

- $from_now_n_ looks like an internal function. why is it not named
__from_now_n?

- $from_now_n_: if minutes < 1 it returns '<1 min', but if
minutes < -10, it returns '???'. why doesn't it return '???' if
minutes < 0 (or < -1 if you want to consider a bit of time skew)?
if -10 is a value for time skew due to mobile phone network delays or
whatever, put it into a local variable?

- $.fn.update_times: this is a syntax question about jquery/javascript.
does this notation import the function update_times into each existing
and future object? i might have overlooked in the tutorials i have
read so far what $.fn.<function_name> means, could you please shed a
bit of light on this?

thanks,
marmorkuchen
--
_ ascii ribbon campaign .oOo. GCSd-s:+aC++ULB+++W++M+PS+++Y+
( )
X Betrachte einen Stock - ein Ende ist Yin, das andere Yang. Welches
/ \ ist wichtiger? Konfuzius: Der Stock selbst! Zen: Da ist Scheisse am Stock!

Joe Edelman

unread,
Mar 9, 2009, 3:47:57 PM3/9/09
to groundcrew-vie...@googlegroups.com
The $.fn.x syntax adds the function to all jQuery objects. So you can
type $('#my_widget').update_times() to update all the relative times
inside of my_widget.

The other dollar functions are really old code before I had any
conventions and they are poorly named.

--Joe

--
J.E. -- http://nxhx.org -- 413.250.8007
Reply all
Reply to author
Forward
0 new messages