{"action":"created","issue":{"url":"https://api.github.com/repos/MithrilJS/mithril.js/issues/2055","repository_url":"https://api.github.com/repos/MithrilJS/mithril.js","labels_url":"https://api.github.com/repos/MithrilJS/mithril.js/issues/2055/labels{/name}","comments_url":"https://api.github.com/repos/MithrilJS/mithril.js/issues/2055/comments","events_url":"https://api.github.com/repos/MithrilJS/mithril.js/issues/2055/events","html_url":"https://github.com/MithrilJS/mithril.js/issues/2055","id":281136760,"number":2055,"title":"The router API should allow its backend to be configurable","user":{"login":"isiahmeadows","id":4483844,"avatar_url":"https://avatars1.githubusercontent.com/u/4483844?v=4","gravatar_id":"","url":"https://api.github.com/users/isiahmeadows","html_url":"https://github.com/isiahmeadows","followers_url":"https://api.github.com/users/isiahmeadows/followers","following_url":"https://api.github.com/users/isiahmeadows/following{/other_user}","gists_url":"https://api.github.com/users/isiahmeadows/gists{/gist_id}","starred_url":"https://api.github.com/users/isiahmeadows/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isiahmeadows/subscriptions","organizations_url":"https://api.github.com/users/isiahmeadows/orgs","repos_url":"https://api.github.com/users/isiahmeadows/repos","events_url":"https://api.github.com/users/isiahmeadows/events{/privacy}","received_events_url":"https://api.github.com/users/isiahmeadows/received_events","type":"User","site_admin":false},"labels":[{"id":534693727,"url":"https://api.github.com/repos/MithrilJS/mithril.js/labels/enhancement","name":"enhancement","color":"fbca04","default":true}],"state":"open","locked":false,"assignee":{"login":"isiahmeadows","id":4483844,"avatar_url":"https://avatars1.githubusercontent.com/u/4483844?v=4","gravatar_id":"","url":"https://api.github.com/users/isiahmeadows","html_url":"https://github.com/isiahmeadows","followers_url":"https://api.github.com/users/isiahmeadows/followers","following_url":"https://api.github.com/users/isiahmeadows/following{/other_user}","gists_url":"https://api.github.com/users/isiahmeadows/gists{/gist_id}","starred_url":"https://api.github.com/users/isiahmeadows/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isiahmeadows/subscriptions","organizations_url":"https://api.github.com/users/isiahmeadows/orgs","repos_url":"https://api.github.com/users/isiahmeadows/repos","events_url":"https://api.github.com/users/isiahmeadows/events{/privacy}","received_events_url":"https://api.github.com/users/isiahmeadows/received_events","type":"User","site_admin":false},"assignees":[{"login":"isiahmeadows","id":4483844,"avatar_url":"https://avatars1.githubusercontent.com/u/4483844?v=4","gravatar_id":"","url":"https://api.github.com/users/isiahmeadows","html_url":"https://github.com/isiahmeadows","followers_url":"https://api.github.com/users/isiahmeadows/followers","following_url":"https://api.github.com/users/isiahmeadows/following{/other_user}","gists_url":"https://api.github.com/users/isiahmeadows/gists{/gist_id}","starred_url":"https://api.github.com/users/isiahmeadows/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isiahmeadows/subscriptions","organizations_url":"https://api.github.com/users/isiahmeadows/orgs","repos_url":"https://api.github.com/users/isiahmeadows/repos","events_url":"https://api.github.com/users/isiahmeadows/events{/privacy}","received_events_url":"https://api.github.com/users/isiahmeadows/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/MithrilJS/mithril.js/milestones/7","html_url":"https://github.com/MithrilJS/mithril.js/milestone/7","labels_url":"https://api.github.com/repos/MithrilJS/mithril.js/milestones/7/labels","id":2584469,"number":7,"title":"2.0.0","description":"","creator":{"login":"isiahmeadows","id":4483844,"avatar_url":"https://avatars1.githubusercontent.com/u/4483844?v=4","gravatar_id":"","url":"https://api.github.com/users/isiahmeadows","html_url":"https://github.com/isiahmeadows","followers_url":"https://api.github.com/users/isiahmeadows/followers","following_url":"https://api.github.com/users/isiahmeadows/following{/other_user}","gists_url":"https://api.github.com/users/isiahmeadows/gists{/gist_id}","starred_url":"https://api.github.com/users/isiahmeadows/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isiahmeadows/subscriptions","organizations_url":"https://api.github.com/users/isiahmeadows/orgs","repos_url":"https://api.github.com/users/isiahmeadows/repos","events_url":"https://api.github.com/users/isiahmeadows/events{/privacy}","received_events_url":"https://api.github.com/users/isiahmeadows/received_events","type":"User","site_admin":false},"open_issues":11,"closed_issues":11,"state":"open","created_at":"2017-06-15T07:51:43Z","updated_at":"2017-12-11T19:21:44Z","due_on":null,"closed_at":null},"comments":0,"created_at":"2017-12-11T19:21:44Z","updated_at":"2017-12-21T18:57:19Z","closed_at":null,"author_association":"COLLABORATOR","body":"It should be possible to configure how URLs are routed, so people aren't having to fork it for use cases like [this](https://gitter.im/mithriljs/mithril.js?at=5a2ed2b5c65707ba2b3cc0a4). For comparison, it'd give us the ability to provide a hook like [React Router's `history` attribute](https://reacttraining.com/react-router/core/api/history), without much work on our part.\r\n\r\n(It's come up on Gitter more than once. Marking for v2 because it's a pretty trivial change on our part.)\r\n\r\nHere's what I propose:\r\n\r\n- Instead of accepting a [mock `$window` directly](https://github.com/MithrilJS/mithril.js/blob/next/router/router.js#L6) for the core router, accept a backend, and default to one that wraps `$window`. Same goes for [the API frontend](https://github.com/MithrilJS/mithril.js/blob/next/api/router.js#L7).\r\n- For the backend, require the following methods and use them in lieu of the given blocks:\r\n    - [`backend.normalize(fragment)`](https://github.com/MithrilJS/mithril.js/blob/next/router/router.js#L10-L14) - Get and normalize the specified fragment.\r\n    - [`backend.setPath(prefix, path, state, title, replace)`](https://github.com/MithrilJS/mithril.js/blob/next/router/router.js#L69-L76) - Set the path given certain options\r\n    - [`backend.initialState()`](https://github.com/MithrilJS/mithril.js/blob/next/router/router.js#L84) - Get the initial state to potentially assign.\r\n    - [`backend.registerResolver(resolver)`](https://github.com/MithrilJS/mithril.js/blob/next/router/router.js#L107-L108) - Register the router's `resolveRoutes` function.\r\n\r\nBasically, I don't want to require every user that needs to override the underlying routing mechanism to redo the entire router, but instead just require them to implement a few methods."},"comment":{"url":"https://api.github.com/repos/MithrilJS/mithril.js/issues/comments/353429386","html_url":"https://github.com/MithrilJS/mithril.js/issues/2055#issuecomment-353429386","issue_url":"https://api.github.com/repos/MithrilJS/mithril.js/issues/2055","id":353429386,"user":{"login":"isiahmeadows","id":4483844,"avatar_url":"https://avatars1.githubusercontent.com/u/4483844?v=4","gravatar_id":"","url":"https://api.github.com/users/isiahmeadows","html_url":"https://github.com/isiahmeadows","followers_url":"https://api.github.com/users/isiahmeadows/followers","following_url":"https://api.github.com/users/isiahmeadows/following{/other_user}","gists_url":"https://api.github.com/users/isiahmeadows/gists{/gist_id}","starred_url":"https://api.github.com/users/isiahmeadows/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isiahmeadows/subscriptions","organizations_url":"https://api.github.com/users/isiahmeadows/orgs","repos_url":"https://api.github.com/users/isiahmeadows/repos","events_url":"https://api.github.com/users/isiahmeadows/events{/privacy}","received_events_url":"https://api.github.com/users/isiahmeadows/received_events","type":"User","site_admin":false},"created_at":"2017-12-21T18:57:19Z","updated_at":"2017-12-21T18:57:19Z","author_association":"COLLABORATOR","body":"If I find time, I'll implement this. It's pretty straightforward."}}
{"actor":{"display_login":"isiahmeadows"}}