wip: More improvements on dev docs
This commit is contained in:
parent
e0a261731f
commit
12652ed646
14 changed files with 222 additions and 218 deletions
|
@ -1,20 +0,0 @@
|
|||
---
|
||||
title: Pattern.apply()
|
||||
---
|
||||
|
||||
A pattern's `apply()` method merges the settings passed to it with
|
||||
the current pattern settings. It is used internally to merge the
|
||||
settings that are passed to the pattern constructor with the default settings.
|
||||
|
||||
<Note>This method is chainable as it returns the Pattern object</Note>
|
||||
|
||||
## Pattern.apply() signature
|
||||
|
||||
```js
|
||||
Pattern pattern.apply(object settings)
|
||||
```
|
||||
|
||||
<Note>
|
||||
You are unlikely to ever user this method directly.
|
||||
</Note>
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
---
|
||||
title: Pattern.needs()
|
||||
---
|
||||
|
||||
A pattern's `needs()` method will return `true` or `false`
|
||||
depending on whether a pattern part is a requirement for the
|
||||
pattern to be drafted in its current configuration. In other
|
||||
words, it will return `true` of the part is *needed*.
|
||||
|
||||
A part is needed if:
|
||||
|
||||
- it is requested by the user in [the `only` pattern setting](/reference/settings/only/)
|
||||
- it is a dependency of a part requested by the user in [the `only` pattern setting](/reference/settings/only/)
|
||||
- [the `only` pattern setting](/reference/settings/only/) is not set or is `false`, and the part is not hidden
|
||||
|
||||
<Note>
|
||||
|
||||
You don't typically use this method. Instead, you configure part
|
||||
dependencies in your [configuration file](/reference/config/).
|
||||
|
||||
</Note>
|
||||
|
||||
## Pattern.needs() signature
|
||||
|
||||
```js
|
||||
bool pattern.needs(string partName)
|
||||
```
|
||||
|
||||
## Pattern.needs() example
|
||||
|
||||
```js
|
||||
import Aaron from "@freesewing/aaron"
|
||||
import models from "@freesewing/models"
|
||||
|
||||
const pattern = new Aaron({
|
||||
settings: {
|
||||
embed: true,
|
||||
},
|
||||
measurements: models.manSize38
|
||||
})
|
||||
|
||||
if (pattern.needs('front')) console.log('Front is needed')
|
||||
else console.log('Front is not needed')
|
||||
```
|
||||
|
||||
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
---
|
||||
title: wants()
|
||||
---
|
||||
|
||||
A pattern's `wants()` method will return `true` or `false`
|
||||
depending on whether a pattern part is requested in the
|
||||
current pattern configuration. In other words, it will
|
||||
return `true` of the part is *wanted* by the user.
|
||||
|
||||
A part is wanted if:
|
||||
|
||||
- it is requested by the user in [the `only` pattern setting](/reference/settings/only/)
|
||||
- [the `only` pattern setting](/reference/settings/only/) is not set or is `false`, and the part is not hidden
|
||||
|
||||
<Note>
|
||||
|
||||
You don't typically use this method. Instead, you configure part
|
||||
dependencies in your [configuration file](/reference/config/).
|
||||
|
||||
</Note>
|
||||
|
||||
## Pattern.wants() signature
|
||||
|
||||
```js
|
||||
bool pattern.wants(string partName)
|
||||
```
|
||||
|
||||
## Pattern.wants() example
|
||||
|
||||
```js
|
||||
import Aaron from "@freesewing/aaron"
|
||||
import models from "@freesewing/models"
|
||||
|
||||
const pattern = new Aaron({
|
||||
settings: {
|
||||
embed: true,
|
||||
},
|
||||
measurements: models.manSize38
|
||||
})
|
||||
|
||||
if (pattern.wants('front')) console.log('Front is wanted')
|
||||
else console.log('Front is not wanted')
|
||||
```
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue