-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Multiple callbacks #120
Comments
Hi! So I don't quite understand how your use case works - you're chaining tweens when "sequencing on the fly"? -- maybe I didn't quite get it. If I wanted to run multiple callbacks when something happened, I would build a callback function that called several callbacks. Does it make sense? |
Closing per lack of activity, reopen if you still need it or want to discuss this further! |
Hello, reopening. Sorry for this! I first experienced this programming idiom on Phaser.
In this example, the tween is being passed around . It's not a terribly important feature but yeah. In my custom version of three js i modified the onComplete fn to be something like this to chain it
Atleast that way, there would'nt be too much refactoring required. |
This would be a breaking change unless we made a new function such as
"addOnComplete", and "onComplete" reset the callback list.
…On Dec 19, 2016 2:45 AM, "Shikiko" ***@***.***> wrote:
Hello, reopening. Sorry for this! I first experienced this programming
idiom on Phaser.
I think a better example of a use case would be something like this ->
function move (PlayerOrObject){
return tween(...).onComplete( ... ) // tween something then cleanup
}
function movePlayer(){
let passedTween = move( Some_Player )
return passedTween.onComplete( ... ) // update something related to player
}
function mainTutorial(){
movePlayer().onComplete(function(){
alert( "Good job!")
})
}
In this example, the tween is being passed around . It's not a terribly
important feature but yeah.
In my custom version of three js i modified the onComplete fn to be
something like this to chain it
if( _onCompleteCallback ){
let temp = _onCompleteCallback
_onCompleteCallback = function(){
temp(),callback()
};
}else{
_onCompleteCallback = callback;
}
Atleast that way, there would'nt be too much refactoring required.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#120 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACCavxQZHphbkvua45HIt6CIqTIarmn3ks5rJmAqgaJpZM4B4vL9>
.
|
Yeah totally. Would have been a nice feature to have unless people are
actively avoiding it for some reason.
On Tue, Dec 20, 2016 at 1:09 AM, Michael Casebolt <notifications@github.com>
wrote:
… This would be a breaking change unless we made a new function such as
"addOnComplete", and "onComplete" reset the callback list.
On Dec 19, 2016 2:45 AM, "Shikiko" ***@***.***> wrote:
> Hello, reopening. Sorry for this! I first experienced this programming
> idiom on Phaser.
> I think a better example of a use case would be something like this ->
>
> function move (PlayerOrObject){
> return tween(...).onComplete( ... ) // tween something then cleanup
> }
>
> function movePlayer(){
> let passedTween = move( Some_Player )
> return passedTween.onComplete( ... ) // update something related to
player
> }
>
> function mainTutorial(){
> movePlayer().onComplete(function(){
> alert( "Good job!")
> })
> }
>
> In this example, the tween is being passed around . It's not a terribly
> important feature but yeah.
>
> In my custom version of three js i modified the onComplete fn to be
> something like this to chain it
>
> if( _onCompleteCallback ){
> let temp = _onCompleteCallback
> _onCompleteCallback = function(){
> temp(),callback()
> };
> }else{
> _onCompleteCallback = callback;
> }
>
> Atleast that way, there would'nt be too much refactoring required.
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <#120 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/
ACCavxQZHphbkvua45HIt6CIqTIarmn3ks5rJmAqgaJpZM4B4vL9>
> .
>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#120 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEiq45mUHNh4puCRpsEEZB-CVgW9A8a7ks5rJrpSgaJpZM4B4vL9>
.
|
Can we allow multiple callbacks instead of one per event?
Example usage:
I actually implemented this partially (only for onComplete callbacks) so will this be a useful addition?
This is the actual use case (why I implemented this feature):
I used this for sequencing on the fly.
The text was updated successfully, but these errors were encountered: