1
0
Fork 0

adds part.attr

This commit is contained in:
Zee 2023-04-12 13:26:22 +00:00
parent e5886e594b
commit c39da468da

View 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>