Skip to content

Commit

Permalink
Readme updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ceoworks committed Jun 24, 2016
1 parent 7767b8b commit 9bcb3d2
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions README.md
Expand Up @@ -2,10 +2,7 @@

[![Build Status](https://secure.travis-ci.org/ceoworks/node-transactions.png?branch=master)](http://travis-ci.org/ceoworks/node-transactions)
[![Coverage Status](https://coveralls.io/repos/ceoworks/node-transactions/badge.svg)](https://coveralls.io/r/ceoworks/node-transactions)
[![npm](https://img.shields.io/npm/dt/n.svg?style=flat-square)](https://www.npmjs.com/package/node-transactions)
[![npm](https://img.shields.io/npm/dm/n.svg?style=flat-square)](https://www.npmjs.com/package/node-transactions)
[![npm](https://img.shields.io/npm/v/n.svg?style=flat-square)](https://www.npmjs.com/package/node-transactions)
[![npm](https://img.shields.io/npm/l/n.svg?style=flat-square)](https://www.npmjs.com/package/node-transactions)
[![npm](https://img.shields.io/badge/npm-1.1.1-blue.svg)](https://www.npmjs.com/package/node-transactions)

## Usage
Examples of code are shown in ./test/index.spec.js
Expand All @@ -15,15 +12,15 @@ In case you are already using `generators-yields` functions - you are completely
If you are writing classic `async-callback` code - you would probably like to look at `thunkify` package.

##API
The first thing you need is the `context` object, which would have all *required* data for tasks execution.
The first thing you need is the `context` object, which would have all **required** data for tasks execution.
```javascript
let context = {
lannisters: false,
starks: true
}
```

The main brick of the *`Node Transactions`* module is a `task`:
The main brick of the **`Node Transactions`** module is a *`task`*:
```javascript
task = {
name: 'westeros',
Expand All @@ -43,5 +40,11 @@ let result = yield new Transactions([task, nextTask, ...], context);
3. `result.error` - the first and only `task.perform` error (only if `result.success === false`)
4. `result.rollbackErrors` - array of possible `task.rollback` errors

To store the intermediate transaction's data, you need to pass into the context your own implementation of storeTransactionState, which would get next args:
```javascript
function *storeTransactionState(name, phase, context) { ... }
context.storeTransactionState = storeTransactionState;
```

## Issues
Any bugs or improvements are appreciated and could be posted at https://github.com/ceoworks/node-transactions/issues

0 comments on commit 9bcb3d2

Please sign in to comment.