You are reading a single comment by @allObjects and its replies. Click here to read the full conversation.
  • With the newly implemented bind and the just to implement Object.getPrototypeOf() - as many Javascript engines implement - including IE9+'s - the _this or that can be eliminated - including the more serious issue of having a global reference to evr (which locks the application down to a given variable name, like a reserved word...).

    this.ser.on('data',Object.getPrototypeOf(this).onWatc­h.bind(thi­s));
    

    @Gordon, if there are a few bytes left to be 'wasted' on Object.getPrototypeOf(object), that would be cool too.

    @Gordon - sorry, again - from your knowledge of the internals of the bind() implementation, what is the memory footprint compared to creating an anonymous function instead? MSDN describes bind() as creating a function with same body on the bound object...

About

Avatar for allObjects @allObjects started