Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#16083 closed enhancement (fixed)

dojo/router: pass captures as additional args to the handler

Reported by: ben hockey Owned by: Brian Arnold
Priority: low Milestone: 1.9
Component: Core Version: 1.8.0
Keywords: Cc:
Blocked By: Blocking:

Description

currently the captures are found on the event object passed to the handler in the evt.params array.

i'd like to suggest an enhancement to also pass those params as additional callbacks to the handler function. for example:

router.register(/^(foo)\/(bar)$/, function (evt, foo, bar) {  };

this is similar to what i've seen with django https://docs.djangoproject.com/en/dev/topics/http/urls/#example and sort of like what happens when you use replace on a string:

'abc'.replace(/(a)(b)(c)/, function (matched, a, b, c) { 
  console.log(arguments); 
});

Change History (4)

comment:1 Changed 7 years ago by ben hockey

Owner: set to Brian Arnold
Status: newassigned

comment:2 Changed 7 years ago by Brian Arnold

Milestone: tbd1.9
Priority: undecidedlow

comment:3 Changed 7 years ago by Brian Arnold

Resolution: fixed
Status: assignedclosed

In [31142]:

Adding parameter arguments to router callbacks, fixes #16083

comment:4 Changed 7 years ago by Brian Arnold

Added this feature, along with tests for both string and regex routes. Thanks for the suggestion, neonstalwart!

Note: See TracTickets for help on using tickets.