Skip to content

Let wait, sayforsecs, thinkforsecs - handle big numbers #1442

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

Closed
wants to merge 3 commits into from
Closed

Let wait, sayforsecs, thinkforsecs - handle big numbers #1442

wants to merge 3 commits into from

Conversation

joker314
Copy link
Contributor

@joker314 joker314 commented Aug 10, 2018

Resolves

This PR resolves #1010

Proposed Changes

For each block definition which uses setTimeout, ensure that the second argument passed to that function is no greater than the largest signed 32-bit integer.

As a result, the wait block in the Control category and the thinkforsecs and sayforsecs blocks in the Looks category will now do their action for a very long time when passed an unreasonably large argument -- rather than instantly completing the relevant action.

Reason for Changes

This maintains compatibility with the way Scratch 2.0 behaved.

@ericrosenbaum stated that:

We often see kids typing in very large numbers like this.

Test Coverage

Manually tested through dragging out the aforementioned trio of blocks and verifying that they have a ring around them for more than a few seconds. Additionally, it was verified that when small numbers (like 5) were passed, the correct amount of time was taken.

On Windows 10,

  • Chrome v68
  • Microsoft Edge

npm test was run, only warnings appeared -- and these were regarding todo comments that existed pior to this pull request's filing.

npm run coverage was terminated half-way through, it was not enjoying that the sprite library was missing. This was not identified as an issue that this pull request created.

@ericrosenbaum
Copy link
Contributor

Thanks! We decided to go a different strategy, which I will implement (see #1010 (comment))

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

Successfully merging this pull request may close these issues.

Can't wait longer than 2147483.647 seconds
4 participants