Skip to content

Commit

Permalink
fix(NodePart): factory method created to help us when creating NodePa…
Browse files Browse the repository at this point in the history
…rt, introduced due to scope hoisting problem with ParcelJS
  • Loading branch information
Stradivario committed Jun 28, 2019
1 parent 04a30ab commit 6008292
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/lib/parts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,15 @@ export class AttributePart implements Part {
}
}

/**
* Creates a new NodePart instance
* Introduced because of scope hoisting problem with parcel js
* https://github.com/parcel-bundler/parcel/issues/3172
*/
export function nodePartFactory(options: RenderOptions) {
return new NodePart(options);
}

/**
* A Part that controls a location within a Node tree. Like a Range, NodePart
* has start and end locations and can set and update the Nodes between those
Expand Down Expand Up @@ -308,7 +317,7 @@ export class NodePart implements Part {

// If no existing part, create a new one
if (itemPart === undefined) {
itemPart = new NodePart(this.options);
itemPart = nodePartFactory(this.options);
itemParts.push(itemPart);
if (partIndex === 0) {
itemPart.appendIntoPart(this);
Expand Down

0 comments on commit 6008292

Please sign in to comment.