Skip to content
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

Suggestions #14

Closed
denis44 opened this issue Jul 2, 2013 · 2 comments
Closed

Suggestions #14

denis44 opened this issue Jul 2, 2013 · 2 comments

Comments

@denis44
Copy link

denis44 commented Jul 2, 2013

Hello Daniel,

Thanks for the great library! I just have 2 suggestions to make this library even better.

I think you can increase javascript file cache to 1 year. If generated file changes, it will also change hash value in url and browser will make a new request for this file. So you can set the cache to 1 year instead of 1 day.

It would be really nice, if you add routing as method chain to your library, so we can use it this way:

Router.account.login({ username : "demouser" })

instead of

Router.action("Account", "Login", { username : "demouser" });

The reason why this feature is so important is because if I change controller or action name, it can happen that I forget to change some magic strings above and this will cause errors. But with this solution visual studio will notice errors and notify you. And then you can also use autocomplete :)

If you want to make your javascript files as small as possible, you can also add a property to disable this feature:

<routeJs exposeAllRoutes="true" routeAsMethodChain="false" />

@Daniel15
Copy link
Owner

Daniel15 commented Jul 3, 2013

Thanks @denis44 :)

For the first suggestion, that's definitely a good idea. I set the caching time to one day just in case I messed something up. I'll definitely increase the cache period in the next release.

For the second suggestion, that's an interesting idea. Using methods for routing is a great idea (T4MVC does it server-side) and I did consider it, I was just worried it'd add additional complexity that isn't required. I'll see if I can add it for the next release. Does autocomplete/intellisense actually work for RouteJs though? I'd be surprised if it did, seeing as the JavaScript is served by an ASP.NET handler rather than being a standard JavaScript file.

Thanks for your feedback!

@Daniel15
Copy link
Owner

The JavaScript cache has been increased to 1 year in the 1.1.1 release which I just pushed to NuGet. 👍

@Daniel15 Daniel15 closed this as completed Jul 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants