andrewdavey / andrewdavey/cassette

setTimeout with lambda causes incorrect minification

Abierto
#483 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
C#
Estrellas
531
Forks
139
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

When I use arrow function:

` setTimeout(() => this._check(), 1000);`

it completely messes up the minified scripts.

My widget that contains that function ends up like this:

```
NEWS.CheckIfItemExists.prototype,
this._timeout(),
this._timeoutMsg.removeClass("hidden"),
this._loading.addClass("hidden"),
```

while it should look like this:
```
NEWS.CheckIfItemExists.prototype={
init:function(){
this._check()
},
_check:function(){
etc. ........
```

After commenting out just the arrow fuction: **() =>** things go back to normal.

I managed to find another way of doing the setTimeout:

`setTimeout(function () { this._check(); }.bind(this), 1000);`

But obviously the arrow function makes the code simpler and it should be just fine with Cassette.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.