adds part.attr
This commit is contained in:
parent
e5886e594b
commit
c39da468da
1 changed files with 38 additions and 0 deletions
38
markdown/dev/reference/api/part/attr/en.md
Normal file
38
markdown/dev/reference/api/part/attr/en.md
Normal file
|
@ -0,0 +1,38 @@
|
|||
---
|
||||
title: Part.attr()
|
||||
---
|
||||
|
||||
This `Part.attr()` method can be used to add attributes to the Part object.
|
||||
It calls `this.attributes.add()` under the hood, and returns the Part object.
|
||||
|
||||
If the third parameter is set to `true` it will call `this.attributes.set()`
|
||||
instead, thereby overwriting the value of the attribute.
|
||||
|
||||
## Signature
|
||||
|
||||
```js
|
||||
Part Part.attr(
|
||||
string name,
|
||||
mixed value,
|
||||
bool overwrite = false
|
||||
)
|
||||
```
|
||||
|
||||
<Tip compact>This method is chainable as it returns the `Part` object</Tip>
|
||||
|
||||
## Example
|
||||
|
||||
<Example caption=" Example of the Part.attr() method">
|
||||
```js
|
||||
({ Point, points, Path, paths, part }) => {
|
||||
|
||||
cont part = {
|
||||
name: 'examples.attribute',
|
||||
draft: ({ attribute, part }
|
||||
) => part.attr()
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
</Example>
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue