Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #17922
| From | JJ <jaejunks@nah.meh> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Source code "objectifying" technique? |
| Date | 2013-01-03 20:13 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <XnsA13E219E61C5Ejj@0.0.0.55> (permalink) |
| References | <XnsA13DB38A51C6jj@0.0.0.55> <kc4ir7$bh7$1@news.albasani.net> |
Stefan Weiss <krewecherl@gmail.com> wrote:
> Okay, as long as you're aware of that calling abc() is _not_ the same
> thing as calling theLib.abc(). At least make sure to check if any of
the
> functions use |this|.
Yes, I always watch out for any of their own objects, "this" usage and
bound functions usage. I leave them as is, if it's beyod my capability.
> Depends on the library, but something like this might work:
> ...
That'll do very nicely. Thanks. Got to get used to this.
> Not every collection of functions can be contained in this way, but it
> should work for your typical bunch-of-global-functions-because-
> -the-author-doesn't-know-any-better library.
Like bound functions?
...
Also, do this two conversions have any functionality difference? Or may
be leads to possible error elsewhere?
//original
function abc(){}
//conversion #1
theLib.abc=function abc(){};
//conversion #2
theLib.abc=function(){};
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Source code "objectifying" technique? JJ <jaejunks@nah.meh> - 2013-01-03 10:34 +0000
Re: Source code "objectifying" technique? Stefan Weiss <krewecherl@gmail.com> - 2013-01-03 19:32 +0100
Re: Source code "objectifying" technique? JJ <jaejunks@nah.meh> - 2013-01-03 20:13 +0000
Re: Source code "objectifying" technique? Stefan Weiss <krewecherl@gmail.com> - 2013-01-03 23:57 +0100
Re: Source code "objectifying" technique? Stefan Weiss <krewecherl@gmail.com> - 2013-01-04 00:44 +0100
Re: Source code "objectifying" technique? JJ <jaejunks@nah.meh> - 2013-01-04 02:00 +0000
Re: Source code "objectifying" technique? Scott Sauyet <scott.sauyet@gmail.com> - 2013-01-03 10:37 -0800
Re: Source code "objectifying" technique? Scott Sauyet <scott.sauyet@gmail.com> - 2013-01-03 10:43 -0800
Re: Source code "objectifying" technique? JJ <jaejunks@nah.meh> - 2013-01-03 20:33 +0000
Re: Source code "objectifying" technique? Scott Sauyet <scott.sauyet@gmail.com> - 2013-01-03 13:09 -0800
Re: Source code "objectifying" technique? JJ <jaejunks@nah.meh> - 2013-01-04 02:33 +0000
csiph-web