Skip to content

Commit

Permalink
Add example on overriding prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
keenondrums committed Jan 2, 2019
1 parent 6dfc4e8 commit d41434e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Boilerplate free class-based action creator following [flux-standard-action](htt
- [Create an action with no payload and meta](#create-an-action-with-no-payload-and-meta)
- [Create an error action with no meta](#create-an-error-action-with-no-meta)
- [Create an error action with meta](#create-an-error-action-with-meta)
- [Customize action prefix](#customize-action-prefix)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

Expand Down Expand Up @@ -140,3 +141,16 @@ new ActionTest6() // Failure
new ActionTest6('test') // Failure
new ActionTest6(5, 45) // Failure
```

### Customize action prefix

```ts
import { ActionStandard } from 'flux-action-class'

abstract class AppBaseAction<Payload = undefined, Meta = undefined> extends ActionStandard<Payload, Meta> {
protected static readonly _prefix = 'app:'
}

class ActionTest7 extends AppBaseAction {}
// Creates action with no payload, no meta, type 'app:ActionTest7' and error = false
```

0 comments on commit d41434e

Please sign in to comment.