Skip to content

Commit

Permalink
fix(view-engine): singleton instance of auSlotBehavior
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Oct 14, 2017
1 parent c53f5cf commit c08db20
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/view-engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ class ProxyViewFactory {
}
}

let auSlotBehavior = null;

/**
* Controls the view resource loading pipeline.
*/
Expand All @@ -73,9 +75,12 @@ export class ViewEngine {
this.appResources = appResources;
this._pluginMap = {};

let auSlotBehavior = new HtmlBehaviorResource();
auSlotBehavior.attributeName = 'au-slot';
metadata.define(metadata.resource, auSlotBehavior, SlotCustomAttribute);
if (auSlotBehavior === null) {
auSlotBehavior = new HtmlBehaviorResource();
auSlotBehavior.attributeName = 'au-slot';
metadata.define(metadata.resource, auSlotBehavior, SlotCustomAttribute);
}

auSlotBehavior.initialize(container, SlotCustomAttribute);
auSlotBehavior.register(appResources);
}
Expand Down

0 comments on commit c08db20

Please sign in to comment.