Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #12875
| From | cezary.tomczyk@gmail.com |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Adding new method to existing object |
| Date | 2012-03-18 04:24 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <5407668.3681.1332069852998.JavaMail.geo-discussion-forums@ynmb12> (permalink) |
| References | (1 earlier) <571e5767-fc18-4945-b356-4004af1145e8@q12g2000yqg.googlegroups.com> <10224075.1379.1331918290476.JavaMail.geo-discussion-forums@yniz5> <694b2fe2-7b9f-4e17-87bf-76ce8969d947@p13g2000yqd.googlegroups.com> <16476250.1111.1331985481075.JavaMail.geo-discussion-forums@vbiz13> <f0fc1577-700f-418e-9f45-28aa5c36eea2@q18g2000yqh.googlegroups.com> |
W dniu niedziela, 18 marca 2012, 00:04:08 UTC+1 użytkownik David Mark napisał: > On Mar 17, 7:58 am, cezary.tomc...@gmail.com wrote: > > W dniu piątek, 16 marca 2012, 21:01:20 UTC+1 użytkownik David Mark napisał: [...] > > Hm, I belive that I was read somewhere about seeting constructor in prototype. But I see that this is not needed. As I understand constructor returns a reference to the Object function that created the instance's prototype. So, I do not have to set this again in my case. I'm right? > You replaced the object referenced by the prototype property of your > constructor, so if you want to make use of the constructor property, > you will have to supply a reference to the constructor. As it sits, > you supplied a reference to another function. Ah see my mistake now. There are so many articles about OO JavaScript programming and sometimes can be everything mix up :-) [...] > > Finally I want to use every method like this: jsCode().method1().method2().methodX(); > > Did you have a look at the OO wrappers for My Library? They are > pretty trivial and do everything you are trying to accomplish. Yes. I know that MyLibrary is OO. That's why I look out there :-) But not everything is clear for me. For example the inherit function I tried to understand how this method works and adapt to my example. It did not work me. So I wanted to do something new, step by step to understand the exact object oriented JavaScript. > > Of course, some methods will return this object, some not. > > Certainly. Making every method "chainable" would be downright > inconvenient as functions often need to communicate back to the caller > (e.g. returning the value of a property). Yes. Agree. -- Regards, CT
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Adding new method to existing object cezary.tomczyk@gmail.com - 2012-03-16 03:56 -0700
Re: Adding new method to existing object David Mark <dmark.cinsoft@gmail.com> - 2012-03-16 04:50 -0700
Re: Adding new method to existing object Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-03-16 15:31 +0100
Re: Adding new method to existing object David Mark <dmark.cinsoft@gmail.com> - 2012-03-16 11:51 -0700
Re: Adding new method to existing object Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-03-17 00:10 +0100
Re: Adding new method to existing object David Mark <dmark.cinsoft@gmail.com> - 2012-03-16 17:25 -0700
Re: Adding new method to existing object Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-03-17 02:04 +0100
Re: Adding new method to existing object David Mark <dmark.cinsoft@gmail.com> - 2012-03-16 18:15 -0700
Re: Adding new method to existing object cezary.tomczyk@gmail.com - 2012-03-16 10:18 -0700
Re: Adding new method to existing object David Mark <dmark.cinsoft@gmail.com> - 2012-03-16 11:56 -0700
Re: Adding new method to existing object David Mark <dmark.cinsoft@gmail.com> - 2012-03-16 13:01 -0700
Re: Adding new method to existing object cezary.tomczyk@gmail.com - 2012-03-17 04:58 -0700
Re: Adding new method to existing object David Mark <dmark.cinsoft@gmail.com> - 2012-03-17 16:04 -0700
Re: Adding new method to existing object cezary.tomczyk@gmail.com - 2012-03-18 04:24 -0700
Re: Adding new method to existing object John G Harris <john@nospam.demon.co.uk> - 2012-03-18 13:16 +0000
Re: Adding new method to existing object John G Harris <john@nospam.demon.co.uk> - 2012-03-16 17:09 +0000
Re: Adding new method to existing object cezary.tomczyk@gmail.com - 2012-03-16 10:46 -0700
Re: Adding new method to existing object Scott Sauyet <scott.sauyet@gmail.com> - 2012-03-16 13:43 -0700
Re: Adding new method to existing object Scott Sauyet <scott.sauyet@gmail.com> - 2012-03-16 20:15 -0700
Re: Adding new method to existing object cezary.tomczyk@gmail.com - 2012-03-17 05:17 -0700
Re: Adding new method to existing object cezary.tomczyk@gmail.com - 2012-03-17 05:24 -0700
Re: Adding new method to existing object David Mark <dmark.cinsoft@gmail.com> - 2012-03-17 16:16 -0700
Re: Adding new method to existing object cezary.tomczyk@gmail.com - 2012-03-18 04:27 -0700
csiph-web