1
0
Fork 0
freesewing/sites/dev/docs/reference/store-methods/generatemacroids
Joost De Cock ab3204f9f1 chore: Port FreeSewing.dev to docusaurus
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.
2024-09-28 13:13:48 +02:00
..
readme.mdx chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00

---
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'
)
```