-
Notifications
You must be signed in to change notification settings - Fork 3
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
API for breaking stack queue execution #2
Comments
On sequelize/sequelize#1852, @mickhansen and me have discussed some approaches to short-circuit API Proposal// Pass a `control` method with methods on it
// `control` would have to be backwards compatible (for those who use `next`)
// should have the same behavior as `control.continue`
stack.queue(function ( next ) {
next();
});
// continue to next stack queued method
// Same as old `next`
stack.queue(function ( control ) {
control.continue();
});
// break queue without a reason
stack.queue(function ( control ) {
control.break();
});
// break queue fulfilling without a result
stack.queue(function ( control ) {
control.break.fulfilling();
});
// break queue rejecting without an error
stack.queue(function ( control ) {
control.break.rejecting();
});
// break queue fulfilling with a result
stack.queue(function ( control ) {
control.break.fulfilling([
'some',
'data'
]);
});
// break queue rejecting without an error
stack.queue(function ( control ) {
control.break.rejecting( new Error( "breaking things, just for fun" ) );
}); |
Also, if We can think about logging a deprecated message when something is returned from a method within stack which is using For detecting |
Currently
stack-queue
stack queue execution breaking is defined bybreakOn
method option, which defaults for breaking onString
type values.Would you like to see implemented any other kind of breaking methods or API?
ping @brunocasanova @ajbloureiro @gabrielpconceicao
@mickhansen it would be great if you give your opinion also, since it could be useful also for
sequelize
. ( related with sequelize/sequelize#2932 )The text was updated successfully, but these errors were encountered: