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
Refactor the whole asynchronous route action control flow using async/await syntax and make the go method return a Promise.
⚠️This will break how the current action control flow works with the state.resolve() and state.reject() methods.
This refactor should be released as the v3.
importhighwayfrom'backbone-highway'highway.route({name: 'profile',path: '/users/:name',action: async(state)=>{console.log(`Hello ${state.params.name}`)// Get some user dataconstdata=awaitfetch(`/api/users/${state.params.name}`)returndata.id// 42}})constuserId=awaithighway.go({name: 'profile',params: {name: 'rascarlito'})console.log('User id #',userId)// User id #42
I don't think actually getting data from calling the router should actually be very useful, but listening to when the route action has actually finished executing is.
The text was updated successfully, but these errors were encountered:
Refactor the whole asynchronous route action control flow using
async/await
syntax and make thego
method return aPromise
.state.resolve()
andstate.reject()
methods.This refactor should be released as the v3.
I don't think actually getting data from calling the router should actually be very useful, but listening to when the route action has actually finished executing is.
The text was updated successfully, but these errors were encountered: