andrewdavey / andrewdavey/cassette

setTimeout with lambda causes incorrect minification

Đang mở
#483 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
C#
Star
531
Fork
139
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.