@hypen-space/core 0.4.39 → 0.4.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/app.ts CHANGED
@@ -639,8 +639,19 @@ export class HypenModuleInstance<T extends object = any> {
639
639
  target[lastSeg] = payload.value;
640
640
  });
641
641
 
642
- // Call onCreated
643
- this.callCreatedHandler();
642
+ // Call onCreated — store the promise so callers can await initialization
643
+ this._readyPromise = this.callCreatedHandler();
644
+ }
645
+
646
+ /** Promise that resolves when onCreated handler has completed */
647
+ private _readyPromise: Promise<void> = Promise.resolve();
648
+
649
+ /**
650
+ * Wait for the module's onCreated handler to complete.
651
+ * Call this before renderSource to ensure state is fully initialized.
652
+ */
653
+ async waitForReady(): Promise<void> {
654
+ await this._readyPromise;
644
655
  }
645
656
 
646
657
  /**