What does the following assignment mean in the coffeescript snippet? -


i saw class a, after class definition

class    constructor: (@x=0, @y=0) ->  @a = 

what @a = here?

it helps @ generated output.

// generated coffeescript 1.9.3 (function() {   var a;    = (function() {     function a(x, y) {       this.x = x != null ? x : 0;       this.y = y != null ? y : 0;     }      return a;    })();    this.a = a;  }).call(this); 

so @a translates this.a. when this used @ top level, refers window. @a = a exports class onto window object.

this done export library. example, window.$ = jquery or window._ = lodash.


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -