From cba7db79a87edd4d57c61d42b9b4ec790d206091 Mon Sep 17 00:00:00 2001 From: Brahim Hadriche Date: Fri, 14 Jul 2023 08:25:12 -0400 Subject: [PATCH] Make component ready on afterScopeCreate (#843) --- src/Program.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Program.ts b/src/Program.ts index 256250ec7..0e1114cf4 100644 --- a/src/Program.ts +++ b/src/Program.ts @@ -159,7 +159,6 @@ export class Program { protected addScope(scope: Scope) { this.scopes[scope.name] = scope; - this.plugins.emit('afterScopeCreate', scope); } /** @@ -474,6 +473,8 @@ export class Program { //register this compoent now that we have parsed it and know its component name this.registerComponent(xmlFile, scope); + //notify plugins that the scope is created and the component is registered + this.plugins.emit('afterScopeCreate', scope); } else { //TODO do we actually need to implement this? Figure out how to handle img paths // let genericFile = this.files[srcPath] = { @@ -561,6 +562,7 @@ export class Program { const sourceScope = new Scope('source', this, 'scope:source'); sourceScope.attachDependencyGraph(this.dependencyGraph); this.addScope(sourceScope); + this.plugins.emit('afterScopeCreate', sourceScope); } }