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

Naming the URL observable #176

Open
matthewp opened this issue Jul 3, 2018 · 5 comments
Open

Naming the URL observable #176

matthewp opened this issue Jul 3, 2018 · 5 comments

Comments

@matthewp
Copy link
Contributor

matthewp commented Jul 3, 2018

can-route 4.2.0 will introduce a new way to set what type of URL observable will be used. As the default, it is can-route-hash, but can-route-pushstate users will need to set it.

This is similar to how you set route.data to be your ViewModel. The flow will be something like:

import { route, RoutePushstate } from "can";
import AppViewModel from "./app";

route.urlData = new RoutePushstate();
route.data = new AppViewModel();

route.register("{page}");
route.start();

What is a good name for this property? Is urlData ok or something else?

cc @phillipskevin @chasenlehara @justinbmeyer

@justinbmeyer
Copy link
Contributor

justinbmeyer commented Jul 3, 2018

@matthewp How would we handle development.html? I think mapping can-route-pushstate to can-route-hash should still work.

@phillipskevin
Copy link
Contributor

So the can-bind stuff is done internally? Instead of making people type something like this:

import { route, RoutePushstate, Bind } from "can";
import AppViewModel from "./app";

var routeBinding = new Bind({
    child: new AppViewModel(),
    parent: new RoutePushstate()
});

route.register("{page}");
routeBinding.start();

@phillipskevin
Copy link
Contributor

I guess this would be prohibitive since there's a lot more to the binding (

canRoute._canBinding = new Bind(bindingOptions);
).

@matthewp
Copy link
Contributor Author

matthewp commented Jul 3, 2018

@phillipskevin We want to move towards more directly using can-bind in a way that users could do the same themselves if needed. So removing the internal stuff like that is something we can do in the future. This particular change is a bridge between the old API (removing backwards compatible, except for can-route-pushstate), and the new one that will work more like that, hopefully.

@matthewp
Copy link
Contributor Author

matthewp commented Jul 4, 2018

I guess we're going to stick with urlData for now.

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

3 participants