eclipsesource / eclipsesource/tabris-js
Animation abortion should not reject
- Dominant language
- JavaScript
- Stars
- 1.4k
- Forks
- 171
- PR merge metrics
- No merged PRs in 30d
Description
### Problem description
Animation abortion happens during common interactions with an app, for example closing a page that contains a widget whose animation is still running (see snippet). Currently, Tabris.js rejects in this case, which is very unexpected. Moreover, `animate()` rejects with `undefined` and not with a proper `Error`, resulting in confusing logs as this breaks Tabris' error handling when the promise rejection is not caught:
```
> Uncaught promise rejection (id: 0)
formatPromiseRejectionReason@http://192.168.6.58:8081/node_modules/tabris/tabris.min.js:1:15468
@http://192.168.6.58:8081/node_modules/tabris/tabris.min.js:1:24618
@http://192.168.6.58:8081/node_modules/tabris/tabris.min.js:1:13760
```
When animation abortion errors do get caught, they are hard to debug as `undefined` does not have a stack trace.
### Expected behavior
Animation abortion should never reject. Rather, `animate()` could asynchronously return a result object which can indicate whether the animation had been aborted.
### Environment
- Tabris.js version: nightly
### Code snippet
```js
import {Composite, TextInput, contentView, NavigationView, Page} from 'tabris';
let box;
contentView.append(
new NavigationView({left: 0, top: 0, right: 0, bottom: 0}).append(
new Page({title: 'page1'}),
new Page({title: 'page2'}).append(
box = new Composite({centerX: 0, centerY: 0, width: 100, height: 100, background: 'red'})
)
)
)
setTimeout(() => {
box.animate({transform: {rotation: 50}}, {duration: 5000})
});
```
Contributor guide
Assessment
This issue has not been assessed yet.