feat(core): Added name property to parts to hold the part name
This commit is contained in:
parent
c44bf4409e
commit
39d1cdd0ca
1 changed files with 4 additions and 2 deletions
|
@ -100,12 +100,14 @@ export default function Pattern(config = { options: {} }) {
|
|||
}
|
||||
|
||||
// Part closure
|
||||
this.Part = function () {
|
||||
this.Part = function (name = false) {
|
||||
let part = new Part()
|
||||
part.context = context
|
||||
for (let macro in context.macros) {
|
||||
part[macroName(macro)] = context.macros[macro]
|
||||
}
|
||||
if (name) part.name = name
|
||||
|
||||
return part
|
||||
}
|
||||
}
|
||||
|
@ -155,7 +157,7 @@ Pattern.prototype.draft = function () {
|
|||
this.runHooks('preDraft')
|
||||
for (let partName of this.config.draftOrder) {
|
||||
if (this.debug) this.raise.debug(`Creating part \`${partName}\``)
|
||||
this.parts[partName] = new this.Part()
|
||||
this.parts[partName] = new this.Part(partName)
|
||||
if (typeof this.config.inject[partName] === 'string') {
|
||||
if (this.debug)
|
||||
this.raise.debug(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue