
The replaces the NextJS site powering FreeSewing.dev with a Docusaurus setup. It's part of my efforts to simplify FreeSewing's setup so we can focus on our core value proposition.
37 lines
749 B
Text
37 lines
749 B
Text
---
|
|
title: generateMacroIds()
|
|
---
|
|
|
|
The `generateMacroIds()` store method generates IDs to be used in macros.
|
|
It is the recommended way for macros that add nodes to the pattern (by nodes we
|
|
mean points, paths and so on) to avoid naming clashes.
|
|
|
|
## Signature
|
|
|
|
```mjs
|
|
Object store.generateMacroIds(
|
|
Array keys,
|
|
String id,
|
|
macro = store.activeMacro
|
|
)
|
|
```
|
|
|
|
The method takes a list of strings, and an ID which is typically the ID passed
|
|
to the macro. You can optionally specify the macro name via `macro` although
|
|
you almost certainly want to rely on the default behavior which is to load the
|
|
active macro name from the store.
|
|
|
|
## Example
|
|
|
|
```mjs
|
|
const ids = store.generateMacroIds(
|
|
[
|
|
'start',
|
|
'end',
|
|
'middle'
|
|
],
|
|
'macroId'
|
|
)
|
|
```
|
|
|
|
|