You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sorry @DinkoMiletic , I just got back from vacation.
Middlewares are sequential, if you add middleware2 before middleware1, the middleware2 will be run first.
If you don't want to change the order and you still want to run middleware2 first, you can always add an if(..) in your middleware1 to not run it in whatever case. You might have to add additional values to help your if(...). If you're writing a middleware object then you can add values in your class, see https://github.com/unbug/js-middleware#middlewaremethods
I ended up with ordering middle-wares before they are run because each part of my app can register own middle-ware but middle-wares should be always executed by priority.
vari;varhooks=[];varhook;varmiddleware=newMiddleware();// this.hook -> list of callbacks to run with priority propertyif(angular.isDefined(this.hooks[name])){hooks=$filter('orderBy')(this.hooks[name],'priority',true);for(i=0;i<hooks.length;i+=1){hook=hooks[i].callback;middleware.use(hook);}}middleware.go.apply(this,Array.prototype.slice.call(arguments,1));
Is it possible to add execution order of middleware.
Let's say we have multiple middlewares (middleware1, middlewarr2, middleware3) attached to
walk
function.It would be great if I could specify that middlewarr2 should run first.
The text was updated successfully, but these errors were encountered: