Skip to content
This repository has been archived by the owner on Aug 1, 2018. It is now read-only.

Commit

Permalink
Expose middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
lhorie authored and fusion-bot[bot] committed Feb 4, 2018
1 parent d35bd20 commit 94ec1c5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ export default () => (

### API

#### PreparePlugin
#### middleware

```js
import {PreparePlugin} from 'fusion-react-async';
import {middleware} from 'fusion-react-async';
```

A plugin that adds a `PrepareProvider` to the React tree.
A middleware that adds a `PrepareProvider` to the React tree.

You should consider using [`fusion-react`](https://github.com/fusionjs/fusion-react) instead of setting up React and registering this plugin manually, since that package does all of that for you.
You should consider using [`fusion-react`](https://github.com/fusionjs/fusion-react) instead of setting up React and registering this middleware manually, since that package does all of that for you.

#### split

Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import prepare from './prepare';
import prepared from './prepared';
import split from './split';
import exclude from './traverse-exclude';
import PreparePlugin from './plugin';
import middleware from './middleware';

// TODO(#3): Can we get ride of some of these exports?
export {dispatched, prepare, prepared, split, exclude, PreparePlugin};
export {dispatched, prepare, prepared, split, exclude, middleware};
5 changes: 1 addition & 4 deletions src/plugin.js → src/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import React from 'react';
import PrepareProvider from './prepare-provider';
function preparePlugin(ctx, next) {
export default function(ctx, next) {
if (__NODE__ && !ctx.element) {
return next();
}
Expand All @@ -17,6 +17,3 @@ function preparePlugin(ctx, next) {
);
return next();
}

// wrap in function in case we need to take config in the future
export default () => preparePlugin;

0 comments on commit 94ec1c5

Please sign in to comment.