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

API changes #5

Merged
merged 2 commits into from
Mar 14, 2016
Merged

API changes #5

merged 2 commits into from
Mar 14, 2016

Conversation

TylorS
Copy link
Member

@TylorS TylorS commented Mar 14, 2016

Instead of composing a historyDriver it internally chooses to use @cycle/history
accepting the same arguments expected by @cycle/history makeHistoryDriver to be passed
to makeRouterDriver(), but composes that driver instance to make a more useful routing
API.

Adjust define() to return an observable containing the latest values matched rather
than flatMapLatest()ing to sepearate all the values when they are inherently connected
rather than separate. This avoids the annoying path$.zip(value$, ...) boilerplate.

Remove the supportsHistory() and createLocation() utilities in favor of the those
provided by @cycle/history, and also exports createServerHistory for convenience.

Breaking Change:

BEFORE:

    const history = createHistory()
    const historyDriver = makeHistoryDriver(history)
    const routerDriver = makeRouterDriver(historyDriver)

    const {path$, value$} = router.define(routes)
    const page$ = path$.zip(value$, (path, value) => {...})

After:

    const routerDriver = makeRouterDriver(createHistory())
    const page$ = router.define(routes).map(({path, value}) => {...})

Instead of composing a historyDriver it internally chooses to use @cycle/history
accepting the same arguments expected by @cycle/history makeHistoryDriver to be passed
to makeRouterDriver(), but composes that driver instance to make a more useful routing
API.
Adjust define() to return an observable containing the latest values matched rather
than flatMapLatest()ing to sepearate all the values when they are inherently connected
rather than separate. The avoids the annoying path$.zip(value$, ...) boilerplate.
Remove the supportsHistory() and createLocation() utilities in favor of the those
provided by @cycle/history, and also exports createServerHistory for convenience.

Breaking Change:

  BEFORE:
    const history = createHistory()
    const historyDriver = makeHistoryDriver(history)
    const routerDriver = makeRouterDriver(historyDriver)

    const {path$, value$} = router.define(routes)
    const page$ = path$.zip(value$, (path, value) => {...})

  After:
    const routerDriver = makeRouterDriver(createHistory())
    const page$ = router.define(routes).map(({path, value}) => {...})
Removes createRouter because it's not very useful
TylorS added a commit that referenced this pull request Mar 14, 2016
@TylorS TylorS merged commit 471a9ba into master Mar 14, 2016
@TylorS TylorS deleted the api-changes branch June 1, 2016 06:39
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

Successfully merging this pull request may close these issues.

None yet

1 participant