Famous / Famous/engine

[bug?] Component onUpdate methods not always being fired.

Open
#478 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.7k
Forks
249
PR merge metrics
No merged PRs in 30d

Description

This has happened in several times to me already, with versions of Famous Engine ranging from 0.5 to 0.7.2, but I'm not at all sure what I have to do prior in order to experience the problem. I have some code like this:

``` js
...
this._positionTransitionable = new Transitionable(0)
this._positionTransitionable.set(200, {duration: 600, curve: 'easeOut'})
let self = this
console.log('node?', node) // node exists, and is a Node
self._goForwardAnimation = node.addComponent({
onUpdate() {
console.log('animating forward') // never fires
if (self._positionTransitionable.isActive()) {
let position = node.getPosition()
node.setPosition(position[0], position[1], self._positionTransitionable.get())
node.requestUpdateOnNextTick(self._goForwardAnimation)
}
else { // clean up.
console.log('Getting rid of the component.')
node.removeComponent(self._goForwardAnimation)
}
}
})
node.requestUpdateOnNextTick(self._goForwardAnimation)
...
```

The expected behavior is that the `_goForwardAnimation` will start updating after being started with `node.requestUpdateOnNextTick`, but it doesn't happen. The `console.log` inside the component never fires.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.