In addition all previous comments:
I don't like name 'self' as alias to 'this' ( I tend to interpret same way
as 'this', e.i context of current function). Instead, use same name you
would use for your object instance. Example:
Client.prototype.doStuff = function() {
var client = this;
// ...
22.04.2014, 00:11, "Reza Razavipour" :I see a lot of code that does var self = this and then they use self instead of this for the duration of the function? Why and when would you use the above pattern? When you are: 1. need to use callbacks2. unable to use arrow functions3. unwilling to explici
A.prototype.a (cb) {
// I do something here
cb(null, someData);
};
A.prototype.b () {
self = this;
// it could be `this.a` as well.
self.a(function (err, response) {
self.c(response); // will work
this.c(response); // wont work
});
};
A.prototype.c (data) {
console.log(data)
On Mon, Apr 21, 2014 at 4:26 PM, Reza Razavipour
wrote:
> would you still do that if you want to change something about this? mix
> self and this?
>
I would never mix the two. Everything is a reference in Javascript so
changes to self are changes to this.
--
--
Job Board: http://jobs.nodejs.or
On Apr 21, 02014, at 16:11, Reza Razavipour wrote:
> I see a lot of code that does
> var self = this
>
> and then they use self instead of this for the duration of the function?
>
> Why and when would you use the above pattern?
Consider this:
var obj = {
method: function() {
//
would you still do that if you want to change something about this? mix
self and this?
Regards,
Reza
On Mon, Apr 21, 2014 at 1:13 PM, Matt wrote:
> It's good practice because in callbacks "this" is no longer what you
> thought it was, whereas that self variable will be. I tend to do it out of
It's good practice because in callbacks "this" is no longer what you
thought it was, whereas that self variable will be. I tend to do it out of
habit even if there are no callbacks because there might be one some day
down the line.
On Mon, Apr 21, 2014 at 4:11 PM, Reza Razavipour
wrote:
> I see
I see a lot of code that does
var self = this
and then they use self instead of this for the duration of the function?
Why and when would you use the above pattern?
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelin
Node JS- Lead Developer-(Perm Hire)
--
*Experience- *3-5 Yrs years.
*Position Qty *– 4
*Salary Range*-(should be the expected CTC's of the candidates)
2 – 3 Yrs: 5.Lpa – 6Lpa
3 – 4 Yrs: 6 Lpa
It works! Big thank you!!!
On Monday, April 21, 2014 9:18:53 PM UTC+2, Colin wrote:
>
> You need to serialize your server side Jade variables into client side
> variables. One way to do this would be trying something like this in your
> Jade view/template before you include your external JavaScr
You need to serialize your server side Jade variables into client side
variables. One way to do this would be trying something like this in your
Jade view/template before you include your external JavaScript file...
script.
var title = !{JSON.stringify(title)};
Colin
On Mon, Apr 21, 2014 at
On Apr 21, 2014, at 13:57, Evgeny Nepomnyashchiy wrote:
> I pass some parameters to jade renderer, example is res.render('add', {title:
> "Hello"}). On client-side I have external JS-file, how can I get an access to
> the title param? Code console.log(name) gets me undefined value.
Those varia
Probably my the last post looks like a fix of the problem, but it was just
a fix of mistake in my first post in the thread. Problem is still actual.
On Monday, April 21, 2014 8:59:13 PM UTC+2, Evgeny Nepomnyashchiy wrote:
>
> Ooops, mistake. Fixed version: console.log(title).
>
> On Monday, April
Ooops, mistake. Fixed version: console.log(title).
On Monday, April 21, 2014 8:57:39 PM UTC+2, Evgeny Nepomnyashchiy wrote:
>
> Hello,
>
> I pass some parameters to jade renderer, example is res.render('add',
> {title: "Hello"}). On client-side I have external JS-file, how can I get
> an access
Hello,
I pass some parameters to jade renderer, example is res.render('add',
{title: "Hello"}). On client-side I have external JS-file, how can I get an
access to the title param? Code console.log(name) gets me undefined value.
Thank you!
--
--
Job Board: http://jobs.nodejs.org/
Posting guid
I used the Hilbert curve to order the nodes for quad tree nodes that stored
geographic information and road data. It did not give much improvement over
z-curve.
On Wed, Apr 16, 2014 at 7:44 AM, barroudjo wrote:
> Hey there. I realize I'm resurecting an old post, but there's been no
> further wo
Thanks Angel, I do not use App with uppercase, has been a type error.
alejandro.pacio...@gmail.com
2014-04-21 7:31 GMT-03:00 Angel Java Lopez :
> Additional comments:
>
> In your tree, there is 'app'. In your require 'App'. I'm not sure if that
> name could be used without Windows.
>
> __dirn
Additional comments:
In your tree, there is 'app'. In your require 'App'. I'm not sure if that
name could be used without Windows.
__dirname is not the current directory (as in pwd command line). It is the
directory of the current script.
More info:
http://stackoverflow.com/questions/8131344/wha
I am reading your message 3rd time, perhaps you don't realise you are
spamming the group again and again. Am I wrong guys?
-arvind
On Mon, Apr 21, 2014 at 3:45 PM, wrote:
> Ave Infosys is a leading professional in Web Designing Company in
> Hyderabad India for the E-Business Industry.Ave Infos
Ave Infosys is a leading professional in Web Designing Company in Hyderabad
India for the E-Business Industry.Ave Infosys are providing Best Website
Development and Design Services in Hyderabad.Our company offers the Best
Web Design & Development services, Web Hosting,Responsive and Mobile
Desi
Ave Infosys is a leading professional in Web Designing Company in Hyderabad
India for the E-Business Industry.Ave Infosys are providing Best Website
Development and Design Services in Hyderabad.Our company offers the Best
Web Design & Development services, Web Hosting,Responsive and Mobile
Desi
21 matches
Mail list logo