Skip to content

Add option to ignore empty reference #1

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

Merged
merged 2 commits into from
Aug 14, 2020
Merged

Add option to ignore empty reference #1

merged 2 commits into from
Aug 14, 2020

Conversation

XeduR
Copy link
Contributor

@XeduR XeduR commented May 16, 2020

Add an option to disable the default transition behaviour where passing a nil value to transition's transition.pause(), transition.resume() or transition.cancel() API will control all existing transitions.

Some users, myself included, have had issues with accidentally passing an already removed transition reference to one of the aforementioned functions, which has unintentionally affected all existing transitions.

This new feature will allow users to optionally prevent that behaviour. These code changes will not break (or even affect) any existing projects. If a user wishes to prevent this default behaviour, then they simply need to set:

transition.ignoreEmptyReference = true


This PR also introduces 3 new API calls that the users can use to explicitly control all existing transitions: transition.pauseAll(), transition.resumeAll() or transition.cancelAll(). These new API calls are in line with the new and pending timer API calls.


Fixes coronalabs/corona#55

XeduR added 2 commits May 16, 2020 08:59
Add an option to disable the default transition behaviour where passing a nil value to transition's pause, resume or cancel API will control all existing transitions.

Some users, myself included, have had issues with accidentally passing an already removed transition reference to the transition API will affect all transitions. This new feature will allow users to optionally prevent that behaviour.

This also introduces 3 new API calls that the users can use to explicitly control all existing transitions.

The code changes will not break existing projects and using this feature will be opt-in.
@XeduR
Copy link
Contributor Author

XeduR commented May 16, 2020

Added a simple check where transition.pause() and transition.resume() are only run if there is a valid targetType.

If the user has set the new transition.ignoreEmptyReference = true then passing empty/nil to the aforementioned functions would mean there is no target to pause or resume and so the remainder of these functions don't need to be run.

@Shchvova Shchvova merged commit 75c62bb into coronalabs:master Aug 14, 2020
Shchvova pushed a commit to coronalabs/corona-docs that referenced this pull request Aug 21, 2020
Update existing documentation and add new documentation for timer and transition libraries to explain the changes introduced in:

coronalabs/framework-timer#2

and

coronalabs/framework-transition#1
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

Successfully merging this pull request may close these issues.

Transition.cancel(whatToCancel) | Not working as intended.
2 participants