intercellular / cell

A self-driving web app framework
https://www.celljs.org
MIT License
1.51k stars 94 forks source link

ES6 functions #162

Closed hollerith closed 6 years ago

hollerith commented 6 years ago

Ok not sure probably my bad not understanding js but I was messing with a copypasta of the orly tut, and found that if I replace

$update: function() {...}

with

$update: ()=>{...}

that this borken something and this (and this._params) referred to the window rather than the thing IYGMD,

gliechtenstein commented 6 years ago

The fat arrow syntax works differently than regular functions. More specifically the whole point of fat arrow functions is to lock the context inside the function.

So this is exactly what's supposed to happen. It's not related to the library, it's just how JavaScript works.

Going to close since it's not a bug and not related to the library (It's about how ES6 works). But feel free to reply and ask if you have further questions. Thanks!