1
0
Fork 0
freesewing/sites/dev/docs/reference/hooks/predraft/readme.mdx

27 lines
502 B
Text
Raw Normal View History

---
title: preDraft
---
2022-09-29 23:43:00 +02:00
The `preDraft` lifecycle hook runs just before your pattern is drafted.
2022-09-29 23:43:00 +02:00
## Signature
2022-09-29 23:43:00 +02:00
```js
null hook(Pattern pattern)
```
2022-09-29 23:43:00 +02:00
## Example
2022-09-29 23:43:00 +02:00
```js
pattern.on('preDraft', pattern => {
// Mutate the pattern object here
}
```
## Notes
The `preDraft` hook fires once for all the sets in the pattern.
While typically, there is only one set, there might be more.
In that case, the [`preSetDraft` lifecycle hook](/reference/hooks/presetdraft) is
the per-set equivalent of this hook.