kadirahq / flow-router

Carefully Designed Client Side Router for Meteor
MIT License
1.09k stars 193 forks source link

Can triggers run asynchronously? #736

Open yanickrochon opened 6 years ago

yanickrochon commented 6 years ago

Is it possible to run triggers asynchronously?

For exampls :

FlowRouter.route('/home', {
  // calls just before the action
  triggersEnter: [checkPermissions],
  action: function() {
    // do something you like
  }
});

function checkPermissions(context, redirect, stop) {
  return http.get('/path/to/service', params).catch(e => {
    stop();
  });
}

Where the action does not get executed unto the Promise is resolved?