Skip to content

Commit

Permalink
docs(api): describe API
Browse files Browse the repository at this point in the history
  • Loading branch information
blond committed Dec 12, 2016
1 parent 9d4a4ae commit a7e47f4
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions README.md
Expand Up @@ -46,6 +46,73 @@ cell.layer; // common
cell.id; // button__text@common.css
```

API
---

* [constructor(obj)](#constructorobj)
* [entity](#entity)
* [tech](#tech)
* [layer](#layer)
* [id](#id)

### constructor(obj)

Parameter | Type | Description
--------------|-----------------|------------------------------
`obj.entity` | `BemEntityName` | Representation of entity name.
`obj.tech` | `string` | Tech of cell.
`obj.layer` | `string` | Layer of cell.

### entity

Returns the name of entity.

```js
const BemCell = require('@bem/cell');
const BemEntityName = require('@bem/entity-name');

const cell = new BemCell({
entity: new BemEntityName({ block: 'button', elem: 'text' })
});

cell.entity; // ➜ BemEntityName { block: 'button', elem: 'text' }
```

### tech

Returns the tech of cell.

```js
const BemCell = require('@bem/cell');
const BemEntityName = require('@bem/entity-name');

const cell = new BemCell({
entity: new BemEntityName({ block: 'button', elem: 'text' }),
tech: 'css'
});

cell.tech; // ➜ css
```

### id

Returns the identifier of this cell.

**Important:** should only be used to determine uniqueness of cell.

```js
const BemCell = require('@bem/cell');
const BemEntityName = require('@bem/entity-name');

const cell = new BemCell({
entity: new BemEntityName({ block: 'button', elem: 'text' }),
tech: 'css',
layer: 'desktop'
});

cell.id; // ➜ "button__text@desktop.css"
```

License
-------

Expand Down

0 comments on commit a7e47f4

Please sign in to comment.