preSetDraft

The preSetDraft lifecycle hook runs just before a set (of settings) is drafted. It will fire once for each set when calling Pattern.draft().

Signature

Javascript
null hook(Pattern pattern)

Example

Javascript
pattern.on('preSetDraft', pattern
 => {
  // Mutate the pattern object here
}

Notes

The preSetDraft fires once for each set in the pattern.

The pattern tracks the active set on the activeSet property. So if you are using this hook and would like to get access to teh active set, you can do so like this:

Javascript
pattern.on('preSetDraft', ({ settings, activeSet }
) => {
  const set = settings[Number(activeSet)]

  // Now set holds the active set of settings
}