-
Notifications
You must be signed in to change notification settings - Fork 11
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
Router.go takes an unordered object, but arguments depends on ordering #5
Comments
Essentially, it is not safe to pass more than one argument as I see it |
After reading a bit I saw that all browsers support ordering, although not explicitly supported by the specification. So this point might not be that urgent |
Solution with different syntax to solve this problem: Instead of router.go(.., .., {param1: a, param2: b}), we can go for router.go(.., .., [['param1', a], ['param2', b]}) The router.go function can then create a new Map() of this last argument which is ordered by nature |
And maybe introducing a special parameter resolver to ensure correct formatting with the router. Like: |
Suggestion 2: using ES7 decorators. E.g.
and have either the query map to the specified order OR passing a simple JSON object to the router.go function. Making router.go as simple as:
|
I'm not too excited about the semantics of those solutions, but automatically parsing the correct argument order through reflection still seems super expensive: http://jsperf.com/function-tostring-performance. Let's keep this parked for a little while longer. |
In Javascript, there is no guarantee of ordering of object properties. The ordering is crucial inside the controllers, so I would consider to make the arguments as an array.
The text was updated successfully, but these errors were encountered: