Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setTimeout with lambda causes incorrect minification #483

Open
Nagareboshi18 opened this issue Feb 20, 2020 · 0 comments
Open

setTimeout with lambda causes incorrect minification #483

Nagareboshi18 opened this issue Feb 20, 2020 · 0 comments

Comments

@Nagareboshi18
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant