{"action":"opened","issue":{"url":"https://api.github.com/repos/dojo/app/issues/71","repository_url":"https://api.github.com/repos/dojo/app","labels_url":"https://api.github.com/repos/dojo/app/issues/71/labels{/name}","comments_url":"https://api.github.com/repos/dojo/app/issues/71/comments","events_url":"https://api.github.com/repos/dojo/app/issues/71/events","html_url":"https://github.com/dojo/app/issues/71","id":181470717,"number":71,"title":"Integration with dojo-routing","user":{"login":"novemberborn","id":33538,"avatar_url":"https://avatars.githubusercontent.com/u/33538?v=3","gravatar_id":"","url":"https://api.github.com/users/novemberborn","html_url":"https://github.com/novemberborn","followers_url":"https://api.github.com/users/novemberborn/followers","following_url":"https://api.github.com/users/novemberborn/following{/other_user}","gists_url":"https://api.github.com/users/novemberborn/gists{/gist_id}","starred_url":"https://api.github.com/users/novemberborn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/novemberborn/subscriptions","organizations_url":"https://api.github.com/users/novemberborn/orgs","repos_url":"https://api.github.com/users/novemberborn/repos","events_url":"https://api.github.com/users/novemberborn/events{/privacy}","received_events_url":"https://api.github.com/users/novemberborn/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dojo/app/labels/discussion","name":"discussion","color":"0052cc"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-10-06T16:58:17Z","updated_at":"2016-10-06T16:58:17Z","closed_at":null,"body":"TodoMVC showed that the router cannot [start until the app is ready](https://github.com/dojo/examples/blob/6a65473d2965730fd17a7a36387f0452c76cd9f8/todo-mvc/src/main.ts#L14). App should take care of that itself:\r\n\r\n```ts\r\nconst router = createRouter();\r\n// … add routes\r\n\r\nconst app = createApp({ router });\r\n// … configure app\r\n\r\napp.start(document.body);\r\n```\r\n\r\nWith:\r\n\r\n```ts\r\ninterface AppMixin {\r\n  start(root: Element): Promise<Handle>;\r\n}\r\n```\r\n\r\n`start()` takes care of calling `realize(root)` before calling [`router.start()`](https://github.com/dojo/routing/pull/37).\r\n\r\nHowever other code may need to run after realizing the root element and before starting the router. Perhaps it can take an `afterRealize` handler, changing the interface to:\r\n\r\n```ts\r\ninterface AppMixin {\r\n  start(StartOptions): Promise<Handle>;\r\n}\r\n\r\ninterface StartOptions {\r\n  root: Element;\r\n  afterRealize(): void | Promise<any>\r\n}\r\n```\r\n\r\nI'm assuming it may not be feasible or even desirable to create a router declaratively. We can allow for some other ways of setting the router though:\r\n\r\n```ts\r\napp.router = router; // Like defaultWidgetStore, can only be assigned once\r\n```\r\n\r\n```html\r\n<app-router data-from=\"src/routes\" data-import=\"router\" />\r\n```\r\n\r\nPerhaps as part of `loadDefinition()` too, though you can't set default stores that way.\r\n\r\n---\r\n\r\nRegarding declarative router / route creation I'm struggling with how we'd express what should happen when the route is dispatched. Let's discuss.\r\n\r\n---\r\n\r\nIt'd be cool to have way to declaratively render [links](https://github.com/dojo/routing/issues/46). However it'll be tricky to reference a route (importing it from a module seems too cumbersome) and provide parameters (a JSON attribute?). Beyond the initial declarative content of the document all rendered widgets come from JavaScript perhaps it's best to create links that way.\r\n\r\n---\r\n\r\nThoughts?"}}
{"actor":{"display_login":"novemberborn"}}